Skip to content

Instantly share code, notes, and snippets.

@eriwen
Created September 26, 2010 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eriwen/597619 to your computer and use it in GitHub Desktop.
Save eriwen/597619 to your computer and use it in GitHub Desktop.
YUI Compressor ant build for static content
<project name="eriwen-static" default="prod" basedir=".">
<property name="src.dir" location="${basedir}/static" />
<property name="js.version" value="2" />
<property name="css.version" value="17" />
<target name="prod" depends="js.concatenate, js.minify, css.minify"
description="Full production build">
</target>
<target name="load.properties">
<property file="ant.properties"/>
</target>
<target name="js.concatenate">
<concat destfile="${src.dir}/js/all.${js.version}.js">
<filelist dir="${src.dir}/js" files="main.${js.version}.js, stacktrace.js"/>
</concat>
</target>
<target name="js.minify" depends="js.concatenate">
<apply executable="java" parallel="false">
<fileset dir="." includes="static/js/all.${js.version}.js"/>
<arg line="-jar"/>
<arg path="${basedir}/yuicompressor-2.4.2.jar"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.js" to="*-min.js"/>
<targetfile/>
</apply>
</target>
<target name="css.minify" depends="js.concatenate">
<apply executable="java" parallel="false">
<fileset dir="." includes="static/css/style.${css.version}.css"/>
<arg line="-jar"/>
<arg path="${basedir}/yuicompressor-2.4.2.jar"/>
<arg line="--line-break 0"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.css" to="*-min.css"/>
<targetfile/>
</apply>
</target>
</project>
@eriwen
Copy link
Author

eriwen commented Jan 3, 2012

This is decently old. Recommend using the Gradle plugins for this very thing http://git.io/gradlejs and http://git.io/gradlecss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment