Ant task for minifying JS/CSS files using YUI Compressor

Recently, while working on a project, I had the need for minifying a set of Javascript and CSS files. Although the project was in HTML5 with no server side component, I had set up the build process using Apache Ant.

I looked online for an ant library that could accomplish this and came across one that was almost exactly what I was looking for. It could minify JS files using YUI Compressor but lacked a couple of features I required. So, I went through the library’s source code and added the following features

  • Minification option for CSS files
  • Option to delete original source files after minification

Since other people might want to use these additional features, I’ve made the modified library open source on GitHub:

The README file describes the available options and how to use them. There’s also an example folder with a working ant project for JS/CSS minification. My code is based on the yui-compressor-ant-task hosted on google code.

1 thought on “Ant task for minifying JS/CSS files using YUI Compressor

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s