JsFileSet element

Specifies the input, output, and processing settings for one or more JavaScript files. There can be multiple JsFileSet elements in a WebGrease configuration file.

Attributes and elements

The following sections describe attributes and child elements.

Attributes

Attribute Description Value

Name

Specifies a unique name for this JsFileSet element.

Any string value.

Output

Specifies the output location as a file or folder. The path can be relative or absolute.

A relative or absolute folder or file name.

Child elements

Element Description Value

Autoname element

Specifies the file rename settings.

See Autoname element.

Bundling element

Specifies the bundling settings.

See Bundling element.

ConfigSource element

Specifies a WebGrease configuration file that contains a JsFileSet element and any configured child elements.

A relative or absolute path and file name. For more information, see ConfigSource element.

Inputs element

Specifies the location of the input files.

See Inputs element.

Locales element

Specifies a locale for which there is a corresponding resource (.resx) file.

See Locales element.

Minification element

Specifies the JavaScript minification settings.

See Minification element.

Validation element

Specifies the JavaScript validation settings.

See Validation element.

Autoname element

Specifies the file rename settings.

Attributes

Attribute Description Value

config

Specifies a solution configuration name.

Any configuration name defined in your solution file, such as Debug or Release. This value is case-sensitive.

Child elements

Element Description Value

RenameFiles

Specifies whether the files will be automatically renamed based on a hash of their content.

True or False.

Example

<Autoname config="Debug">
  <!-- disables renaming for the debug config type-->
  <RenameFiles>false</RenameFiles>
</Autoname>

Bundling element

Specifies the bundling settings.

Attributes

Attribute Description Value

config

Specifies a solution configuration name.

Any configuration name defined in your solution file, such as Debug or Release. This value is case-sensitive.

Child elements

Element Description Value

AssembleFiles

Specifies whether bundling is enabled.

True or False.

MinimalOutput

Specifies whether comments are excluded from the output.

True or False.

A value of True specifies that comments are not included.

Example

<Bundling config="Release">
  <!-- enables renaming for the release config type-->
  <AssembleFiles>true</AssembleFiles>
</Bundling>

ConfigSource element

The configSource element specifies a relative or absolute path and file name of a WebGrease configuration file. This enables you to store some or all of the configuration for the JsFileSet element in an external file.

Use this to maintain various default settings in separate files. For example, you can maintain all default JavaScript validation settings in one file and all default JavaScript minification settings in another file.

Attributes

None.

Child elements

None.

Inputs element

Specifies the location of the input files. You can specify multiple locations by including multiple child Input elements.

Attributes

None.

Child elements

Element Description Value

Input

Specifies an input file location. This can be a single file or a folder. If a folder is specified, all files in all subfolders are processed by default; however, you can use attributes to limit which files are processed. For both files and folders, the path can be relative or absolute. If the path is relative and the command-line –in option is used, the value of the –in option is the base path.

A file or folder name. The path can be relative or absolute.

Remarks

The Input element has two attributes that can be used if the value of the Input element is a folder.

Attribute Description Value

Optional

Specifies whether the input is optional.

True or False.

A value of False specifies that the input is required.

Default = False

searchPattern

Specifies the search string to match against filenames in the folder.

See below.

searchOption

Specifies whether subfolders are included.

TopDirectoryOnly or AllDirectories. This value is case-sensitive and is converted to a SearchOption member by the XML parser.

The following wildcard specifiers are permitted in the searchPattern attribute:

Wildcard character Description

*

Match zero or more characters.

?

Match exactly one character.

Characters other than the wildcard specifiers represent themselves. For example, the searchPattern string "*.js" searches for all filenames in the folder that end with the extension ".js". The searchPattern string "s*" searches for all filenames in the folder that begin with the letter "s".

Example

<Inputs>
  <!-- specifies a single file with a relative path -->
  <Input>scripts\site.js</Input>

  <!-- specifies a single file with an absolute path -->
  <Input>f:\webgrease files\scripts\site.js</Input>

  <!-- specifies a folder with a relative path
       All file in this folder and all subfolders will be processed -->
  <Input>scripts\</Input>

  <!-- specifies a folder with a relative path
       The searchPattern attribute specifies that only JavaScript files will be processed
       And the searchOption attribute specifies that subfolders are not included -->
  <Input searchPattern="*.js" searchOption="TopDirectoryOnly">realworldjs</Input>
</Inputs>

Locales element

Specifies a locale for which there is a corresponding resource (.resx) file. Separate locales with a semicolon. A variation is built for each locale.

Attributes

Attribute Description Value

config

Specifies a solution configuration name.

Any configuration name defined in your solution file, such as Debug or Release. This value is case-sensitive.

Child elements

None.

Example

<Locales>en-us;fr-ca</Locales>

Minification element

Specifies the JavaScript minification settings (conditions for minimizing JavaScript files).

Attributes

Attribute Description Value

config

Specifies a solution configuration name.

Any configuration name defined in your solution file, such as Debug or Release. This value is case-sensitive.

Child elements

Element Description Value

GlobalsToIgnore

Specifies the global JavaScript variables that are not minified. Separate variables with a semicolon.

Any global JavaScript variable.

Minify

Specifies whether minification is enabled.

True or False.

MinifyArguments

Specifies the JavaScript minification arguments in Ajax Minifier style.

An Ajax Minifier argument. For more information about Ajax Minifier arguments, see Ajax Minifier Command-Line Switches. Separate arguments with a space.

Example

<Minification config="Debug">
  <!-- disables minification for the debug config type-->
  <Minify>False</Minify>
  <!-- Ajax Minify style arguments (space delimited)-->
  <MinifyArguments>-h -d -m -k</MinifyArguments>
  <!-- JavaScript global variables that will not get altered (semicolon delimited)-->
  <GlobalsToIgnore>jQuery;Msn</GlobalsToIgnore>
</Minification>

Validation element

Specifies the JavaScript validation settings.

Attributes

Attribute Description Value

config

Specifies a solution configuration name.

Any configuration name defined in your solution file, such as Debug or Release. This value is case-sensitive.

Child elements

Element Description Value

Analyze

Specifies whether JavaScript validation is enabled.

True or False.

AnalyzeArguments

Specifies the JavaScript validation arguments in Ajax Minifier style.

An Ajax Minifier argument. For more information about Ajax Minifier arguments, see Ajax Minifier Command-Line Switches. Separate arguments with a space.

Example

<!-- Validation of JavaScript.-->
<Validation config="Debug">
  <!—enables analysis the JavaScript files for the debug config type-->
  <Analyze>True</Analyze>
  <!-- Ajax Minify style arguments (space delimited)-->
  <AnalyzeArguments>-analyze -WARN:4</AnalyzeArguments>
</Validation>

See Also

Last edited Sep 4, 2013 at 6:57 PM by JeffRob, version 2

Comments

No comments yet.