YUI Compressor for NAnt

NAnt is a highly flexible build tool for .NET while YUI Compressor is probably the best Javascript compressor out there so an NAnt task for YUI Compress makes good sense. YUI Compressor is written in JAVA but I managed to find a port of it to .NET and I also came across the source for YUI Compressor task but not compiled DLLs so I built my own using the latest .NET libraries of YUI Compressor.

The YUI Compress tool can be used to minify both, CSS and Javascript. The minified script can really help reduce download times and obfuscate Javascript code from competitors and security adversaries.

Download

The current DLL for the NAnt task is based off YUI Compressor 2.4.2. Download NAnt Task for YUI Compressor 2.4.2.

Installation

From the zip file copy the following files to the NAnt/bin folder:

  • EcmaScript.NET.modified.dll
  • Yahoo.Yui.Compressor.dll
  • aleemb.yui.compress.dll

Usage

<yuicompressor todir="${build.dir}">
   <fileset basedir="javascripts">
      <include name="jquery.js" />
      <include name="base.js" />
   </fileset>
</yuicompressor>

Source

You can check out the source code through github. If you want to make improvements just fork the project or ping me to get write access to the repository.