This project is read-only.

Configure Partially Xpedited Web Site

Although content compression goes a long way to reducing the bandwidth required to download a CSS or JavaScript file from the Web Server, further improvement can be achieved by using a content minifier. Xpedite may support any minifer by implementing the Xpedite.Minification.IResourceMinifier interface. Xpedite has "out-of-the-box" support for both the Microsoft Ajax Minifier (see: http://aspnet.codeplex.com/releases/view/40584) as well as Yui Compressor .NET (see: http://yuicompressor.codeplex.com).

To start using Xpedite for content minification in your web application:
  1. Add a project reference to the Xpedite assembly (i.e., Xpedite.dll),
  2. Add a project reference to the desired Xpedite minifier assembly (i.e., Xpedite.Minification.MsAjaxMinifier.dll or Xpedite.Minification.YuiCompressor.dll )
  3. Register the Xpedite custom configuration section in the web site's web.config file.
  4. Confiure Xpedite with the desired minifier options.
  5. Register the CssMinificationHandler and JavaScriptMinificationHandler in the <system.web> <httpHandlers> section or <system.webServer> <handlers> setction.

Registering the Xpedite custom configuration section

Within the <configuration> element of the web site's web.config file, add the following XML block to register the Xpedite custom configuration section.

<configuration>
  <!-- Other XML -->
  <configSections>
    <section name="xpedite" 
             type="Xpedite.Config.ConfigSectionHandler, Xpedite, PublicKeyToken=a255fab67ac3163b" 
             requirePermission="false"/>
  </configSections>
  <!-- Other XML -->
</configuration>

Once the custom configuration section has been registered in the web.config, the Xpedite configuration section may then be added.

<configuration>
  <!-- Other XML -->
  <xpedite mode="RemoteOnly">    
    <css minifier="Xpedite.Minification.YuiCompressor.YuiCompressorCssMinifier, 
                   Xpedite.Minification.YuiCompressor, 
                   PublicKeyToken=a5fa8a719a542eb8" />
    <javascript minifier="Xpedite.Minification.YuiCompressor.YuiCompressorJavaScriptMinifier, 
                         Xpedite.Minification.YuiCompressor, 
                         PublicKeyToken=a5fa8a719a542eb8" />
  </xpedite>  
  <!-- Other XML -->
</configuration>

Configuring Xpedite's custom configuration section

Xpedite's basic configuration is fairly straight forward.

<configuration>
  <!-- Other XML -->
  <xpedite mode="">    
    <css minifier="" />
    <javascript minifier="" />
  </xpedite>  
  <!-- Other XML -->
</configuration>

xpedite Element

mode
  • RemoteOnly - (Default) Will minify all CSS/JavaScript content not accessed from the local machine (i.e., Development environment/Web Server).
  • On - Will always minify all content regardless of request source (To be used if you want to test against minified scripts during development)
  • Off - Will never minify any content regardless of request source. (To be used if minification is to be temporarily disabled)

xpedite.css Element

minifier
  • Xpedite.Minification.MsAjaxMinifier.MsAjaxCssMinifier, Xpedite.Minification.MsAjaxMinifier, PublicKeyToken=5b15c62789f5a715
  • Xpedite.Minification.YuiCompressor.YuiCompressorCssMinifier, Xpedite.Minification.MsAjaxMinifier, PublicKeyToken=407a2136d535326a

xpedite.javascript Element

minifier
  • Xpedite.Minification.MsAjaxMinifier.MsAjaxJavaScriptMinifier, Xpedite.Minification.MsAjaxMinifier, PublicKeyToken=5b15c62789f5a715
  • Xpedite.Minification.YuiCompressor.YuiCompressorJavaScriptMinifier, Xpedite.Minification.MsAjaxMinifier, PublicKeyToken=407a2136d535326a

Registering Xpedite's custom HTTP Handlers

To enable a partially Xpedited web site, seperate custom HTTP handlers must be registered for CSS and JavaScript.

IIS6

<configuration>
  <!-- Other XML -->
  <system.web>
    <httpHandlers>
      <add verb="GET,HEAD" 
           path="*.css" type="Xpedite.Handlers.CssMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
      <add verb="GET,HEAD" 
           path="*.js" type="Xpedite.Handlers.JavaScriptMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
    </httpHandlers>
  </system.web>
  <!-- Other XML -->
</configuration>

IIS7

<configuration>
  <!-- Other XML -->
  <system.webServer>
    <handlers>
      <add name="CssMinifier" 
           verb="GET,HEAD" 
           path="*.css" type="Xpedite.Handlers.CssMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
      <add name="JavaScriptMinifier"
           verb="GET,HEAD" path="*.js" 
           type="Xpedite.Handlers.JavaScriptMinificationHandler, Xpedite, PublicKeyToken=a255fab67ac3163b"/>
    </handlers>
  </system.webServer>
  <!-- Other XML -->
</configuration>

Last edited Jan 15, 2011 at 9:34 PM by CBaxter, version 7

Comments

No comments yet.