YUI Compressor + Apache ANT Workflow

Things you will need:

Apache ANT: http://ant.apache.org/

Java SDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html

YUI Compressor: http://developer.yahoo.com/yui/compressor/

Set windows enviroment variables: JAVA_HOME pointing to the Java SDK, ANT_HOME pointing to the ant folder and include thouse paths in the PATH variable.

Read this post:



What i do after i setup my ant build is to create a build.bat ( i use windows ) file with the following command:

CALL ant



The workflow

My ant build (made acording to your project needs, there’s no standard or copy & paste solution) minifies and compress all JS and CSS and move them into a new folder called “publish-js” and “publish-css” after that i select all the files on thouse folders and move them to the server. That way i can work with the originals in my enviroment and then when i’m done, i execute the build.bat and i’m ready to upload.

Cool stuff, today i spend almost all day learning how to use the Apache ANT tool, i was afraid of it, but once you understand it, it’s only a good thing that will only make your life happier.

If you dont know anything about ANT or Compressing js files, read this links, your head will hurt but it will be worth it.


Anyway, just wanted to spread the word.