Example WebGrease configuration file

The following example WebGrease configuration file contains three CssFileSet elements and one JsFileSet element.

<?xml version="1.0" encoding="utf-8"?>
<WebGrease>
  <Settings>
    <!-- Specifies two folders that contain image files as relative paths -->
    <ImageDirectories>css\images;f2/i</ImageDirectories>
    <!- - Specifies several image file extensions -->
    <ImageExtensions>png;jpg;jpeg;gif;ico</ImageExtensions>

    <!-- If unspecified, this defaults to the current directory -->
    <TokensDirectory>App</TokensDirectory>
    <!-- subdirectory of above  -->
    <OverrideTokensDirectory>Site1</OverrideTokensDirectory>
  </Settings>

  <!-- Specifies a CssFileSet named Sample that outputs to a relative
       folder location -->
  <CssFileSet name="Sample" output="output\css">

    <!-- Minification settings for the solution’s Debug configuration -->
    <Minification config="Debug">
      <!-- Disables minification for the debug config type-->
      <Minify>False</Minify>
      <!-- Specifies several invalid CSS selectors -->
      <ProhibitedSelectors>*>html,html>body</ProhibitedSelectors>
    </Minification>
    <!-- Minification settings for the solution’s Release configuration -->
    <Minification config="Release">
      <Minify>True</Minify>
      <ProhibitedSelectors>*>html,html>body</ProhibitedSelectors>
    </Minification>

    <!-- Sprite settings for the solution’s Debug configuration -->
    <Spriting config="Debug">
      <!-- Disables combining images into a sprite -->
      <SpriteImages>false</SpriteImages>
    </Spriting>
    <!-- Sprite settings for the solution’s Release configuration -->
    <Spriting config="Release">
      <SpriteImages>false</SpriteImages>
    </Spriting>

    <!-- File renaming settings for the solution’s Debug configuration -->
    <Autoname config="Debug">
      <!-- Disables file renaming -->
      <RenameFiles>false</RenameFiles>
    </Autoname>

    <!--Bundling settings for the solution’s Debug configuration -->
    <Bundling config="Debug">
      <!-- Disables bundling -->
      <AssembleFiles>false</AssembleFiles>
    </Bundling>
    <!--Bundling settings for the solution’s Release configuration -->
    <Bundling config="Release">
      <AssembleFiles>false</AssembleFiles>
    </Bundling>

    <!-- Specifies two locales for which there are different resx files.
         A variation will be built for each. -->
    <Locales>en-us;fr-ca</Locales>

    <!-- Specifies two themes for which there are different resx files.
         A variation will be built for each. -->
    <Themes>red;blue</Themes>

    <!-- Specifies the input locations -->
    <Inputs>
      <!-- Specifies a single file with a relative path -->
      <Input>css\site.css</Input>

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

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

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

  <!-- Specifies a JsFileSet named Sample that outputs to a relative
       folder location -->
  <JsFileSet name="Sample" output="output\js">

    <!-- Minification settings for the solution’s Debug configuration -->
    <Minification config="Debug">
      <!-- Disables minification for the debug config type-->
      <Minify>False</Minify>
      <!—Specifies the Ajax Minify style arguments-->
      <MinifyArguments>-h -d -m -k</MinifyArguments>
      <!-- Specifies two global JavaScript variables that are not minified. -->
      <GlobalsToIgnore>jQuery;Msn</GlobalsToIgnore>
    </Minification>
    <!-- Minification settings for the solution’s Release configuration -->
    <Minification config="Release">
      <Minify>True</Minify>
      <MinifyArguments>-h -d -m -k</MinifyArguments>
      <GlobalsToIgnore>jQuery;Msn</GlobalsToIgnore>
    </Minification>

    <!-- Validation settings for the solution’s Debug configuration -->
    <Validation config="Debug">
      <!-- Enables JavaScript code analysis-->
      <Analyze>True</Analyze>
      <-- Specifies the JavaScript validation arguments in Ajax Minifier style. -->
      <AnalyzeArguments>-analyze -WARN:4</AnalyzeArguments>
    </Validation>
    <!-- Validation settings for the solution’s Release configuration -->
    <Validation config="Release">
      <Analyze>True</Analyze>
      <AnalyzeArguments>-analyze -WARN:4</AnalyzeArguments>
    </Validation>

    <!-- File renaming settings for the solution’s Debug configuration -->
    <Autoname config="Debug">
      <!-- Disables file renaming -->
      <RenameFiles>false</RenameFiles>
    </Autoname>

    <!--Bundling settings for the solution’s Debug configuration -->
    <Bundling config="Debug">
      <!-- Disables bundling -->
      <AssembleFiles>false</AssembleFiles>
    </Bundling>
    <!--Bundling settings for the solution’s Release configuration -->
    <Bundling config="Release">
      <AssembleFiles>false</AssembleFiles>
    </Bundling>

    <!-- Specifies two locales for which there are different resx files.
         A variation will be built for each. -->
    <Locales>en-us;fr-ca</Locales>

    <!-- Specifies the input locations -->
    <Inputs>
      <!-- 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">js</Input>
    </Inputs>
  </JsFileSet>

  <!-- Specifies a CssFileSet named SpriteSample that outputs to a relative
       folder location -->
  <CssFileSet name="SpriteSample" output="output\css">
    <Spriting config="Debug">
      <SpriteImages>false</SpriteImages>
      <AutoVersionBackgroundImages>false</AutoVersionBackgroundImages>
    </Spriting>
    <Spriting config="Release">
      <SpriteImages>true</SpriteImages>
      <AutoVersionBackgroundImages>true</AutoVersionBackgroundImages>
    </Spriting>
    <Minification config="Release">
      <Minify>false</Minify>
    </Minification>
    <Inputs>
      <Input>css\spritetest.css</Input>
    </Inputs>
  </CssFileSet>

  <!-- Specifies a CssFileSet named BundlingSample that outputs a single 
       CSS file to a relative folder location -->
  <CssFileSet name="BundlingSample" output="output\css\Bundle.css">
    <Bundling config="Debug">
      <AssembleFiles>true</AssembleFiles>
    </Bundling>
    <Bundling config="Release">
      <AssembleFiles>true</AssembleFiles>
    </Bundling>
    <Spriting config="Release">
      <SpriteImages>false</SpriteImages>
    </Spriting>
    <Minification config="Release">
      <Minify>false</Minify>
    </Minification>
    <Inputs>
      <Input searchPattern="*.css">css</Input>
    </Inputs>
  </CssFileSet>

</WebGrease>

See Also

Last edited Sep 4, 2013 at 7:13 PM by JeffRob, version 2

Comments

No comments yet.