Minification

Assman has a Content Filter Pipeline that allows you to minify your scripts and stylesheets. It can minify the resources whether they are consolidated or not. To control whether a resource is minified, there is a minify property on the <scripts> and <stylesheet> elements in the Assman.config file. You can also control whether a specific consolidated group will be minified by setting the minify attribute on the individual <group> element. The minify attribute is a boolean. Note that if you set it to true, it will still only modify when running the site in Release mode. A site runs in Release mode when the debug flag is set to false on the <system.web>/<compilation> element.

Minification plugins

Out of the box, javascript is minified using the open source JSMin library. There is currently not a css minification library that ships with Assman. However, there are plugins available. One plugin that is available is the Assman.YuiCompressor plugin. It provides both javascript and css minification. The easiest way to get integrate YUI minification into Assman is to install the Assman.YuiCompressor package. From the NuGet console:
Install-Package Assman.YuiCompressor

If you want to install it manually, you will need to reference the Assman.YuiCompressor assembly from your Web Application, and then add the following lines to the plugins section of your Assman.config file:
<plugins>
    <add type="Assman.YuiCompressor.YuiJavascriptCompressorPlugin, Assman.YuiCompressor, Version=1.0.0.0, Culture=neutral" />
    <add type="Assman.YuiCompressor.YuiCssCompressorPlugin, Assman.YuiCompressor, Version=1.0.0.0, Culture=neutral" />
</plugins>

Last edited Jun 24, 2011 at 12:03 AM by andyalm, version 1

Comments

No comments yet.