As I anticipated yesterday, I implemented the YUI JS compressor inside Subtext's build process, and since it took me a while to understand how to specify the arguments for the NAnt <exec> task I wanted to share the snippet of the build file I created:

<target name="JavaScript.minify">
    <echo message="${filename}" />
    <exec program="java" workingdir="${YUICompressor.dir}">
        <arg value="-jar" />
        <arg value="yuicompressor.jar" />
        <arg value="-o" />
        <arg value="${filename}.min" />
        <arg value="${filename}" />
    <move file="${filename}.min" tofile="${filename}" overwrite="true" />

This target takes the JavaScript file, compress it with the default settings, and overwrite the original file with the compressed one.

Below are the lines used to call the javascript.minify target:

<property name="filename" value="C:\myfolder\common.js"/>
<call target="javascript.minify" />

The filename property must be an absolute path, or relative to the folder where the file yuicompressor.jar is located.