Configuration


<!--
  WebPacker configuration example.
  Configuration must be described in the web.config.
  Also you must register the configuration section in the web.config, like this:
  <configSections>
    <section name="web.packer" type="WebPacker.Configuration.WebPackerSection, WebPacker" />
  </configSections>
  
  NB! In this example all values set to default

  WebPacker configuration.
  + enabled (=true)
    If true middleware is enabled and script and link tags will be pointed to generated packages,
    otherwise script and link tags will be pointed to the sources files.
  + compression (=false)
    If true packages will be gziped if browser support.
  + throwsExceptions (=false)
    If true middleware re-throw exceptions.
    If false script and link tags will be pointed to the sources files on any error.
  + monitoringDelay (=1)
    Delay for re-building package after changing resources.
    It need for reduce rebuilds packages if resources's changes occur with delay.
-->
<web.packer enabled="true" compression="false" throwsExceptions="false" monitoringDelay="1">
<!--
  Package providers define where the generated packages will be stored and how thay will be handled by server.
  + type (required)
    Type of the provider. You can define short type name like "fileSystem" or "memory".
    Supported:
    - WebPacker.Providers.FileSystemPackProvider:
      Store and handle packages by local file sytem. You can use caching by fronend (like nginx or lighttp)
      + outputPath (required)
        Folder path for generated packages
      + versioning (=true)
        If true file name of package will be defined by name and version, otherwise only by name.
    - WebPacker.Providers.MemoryPackProvider:
      Store and handle packages by memory. Provider use caching by ETag.
      + url (required)
        Base url for packages.
      + cacheDuration (=0)
        Browser cach live time (in seconds).
-->
  <provider type="WebPacker.Providers.FileSystemPackProvider" outputPath="~/resources" versioning="true" />
<!--
  Logging
    + type (required)
      Full defined type name of logger.
    + enabled (=false)
-->
  <logger type="WebPacker.Logger.NLogLogger, WebPacker.NLogLogger" enabled="false" name="WebPacker" />
<!-- 
  The collection of filters used in workflow. 
-->
  <filters>
<!--
  Filter.
  + name (required)
    Filter name for refernce by packages
  + type (required)
    Full defined type name of filter
    Supported:
    - WebPacker.Filters.CompositeFilter
      Chained group of filters.
      + packType (required)
        Package file type (css or javascript).
      + filters
        Group of filters.
    - WebPacker.Filters.YuiCssMinifier
      Yahoo CSS Compressor
    - WebPacker.Filters.YuiJavascriptMinifier
      Yahoo Javascript Compressor
-->
    <filter type="WebPacker.Filters.CompositeFilter" name="css" packType="css">
      <filters>
        <filter type="WebPacker.Filters.DotLessFilter, WebPacker.DotLessFilter" />
        <filter type="WebPacker.Filters.YuiCssMinifier" compressionType="stockYuiCompressor" columnWidth="-1"/>
      </filters>
    </filter>
    <filter type="WebPacker.Filters.YuiJavascriptMinifier" name="js" preserveAllSemicolons="false" isObfuscateJavascript="true" lineBreakPosition="1000" disableOptimizations="false" />
  </filters>
<!--
  Package version generator set.
  Default generators: "md5", "hashCode", "lastModified", "manual"
  Use this section if you need define own generator.
-->
  <versionGenerators>
<!--
  Generator of packages version.
  + name (required)
    Name for reference by package.
  + type (required)
    Full defined type name of generator.
-->
    <versionGenerator name="md5" type="WebPacker.VersionGenerators.Md5VersionGenerator" />
  </versionGenerators>
<!--
  Packages.
  + source (optional)
    File name for defined packages. If set -  packages builds from this file and this subsection in web.config will be ignored.
  + monitoring (=false)
    If true all resources will be monitored, can be replaced by package definition.
  + versionGenerator (=manual)
    Default version generator for all packages, can be replaced by the package definition.
-->
  <packs monitoring="false" versionGenerator="manual">
<!--
  Package is a set of resources (css or javascript)
  + name (required)
    Package name for reference.
  + type (required)
    Resources type (css or javaScript).
  + basePath (optional)
    Resources files path prefix.
  + filter (optional)
    Name of package filter. If not set then will be applied first filter from filters set for this type.
  + versionGenerator (optional)
    Name of version generator, if not set then will be applied default from packs set.
  + monitoring (optional)
    Need watch resources files? If not set will be applied value from packs set.
  + version (optional)
    Package version if version generator is "manual".
-->
    <pack name="styles" type="css" basePath="~/content" versionGenerator="md5" monitoring="true">
      <resources>
        <item encoding="utf-8">reset.css</item>
        <item>site.css</item>
      </resources>
    </pack>
    <pack name="jquery" type="javaScript" filter="js" version="1.5.1">
      <resources>
        <item>~/scripts/jquery-1.5.1.js</item>
        <item>~/scripts/jquery.validate.js</item>
      </resources>
    </pack>
  </packs>
</web.packer>

Last edited Sep 13, 2011 at 12:32 PM by pshkarin, version 1

Comments

No comments yet.