Friday, June 4, 2010

The trials of minification

Amy Hoy got me thinking about JS minification and my manager OK'd me to look into it.

Day 1 went very well. I got Sprockets and the YUICompressor working on the command line with a batch file. To integrate this into our Maven process, I wrote a little Maven plugin/mojo I called packJS. Mojos are written in Java so I switched from Sprockets to Combiner. I installed the two jars into my local repository and everything was hunky dory.

Day 2 slid downhill somewhat. It seems the deploy:deploy-file goal doesn't work very well, so I was unable to push the dependencies to our central repository easily.

Day 3 brings new hope, and with it new forehead-rubbing. There's a yuicompressor maven plugin already. Unfortunately it doesn't seem to work either, in aggregation mode at least. It complains the output file does not exist; creating the parent dirs manually may help, but clean will erase them again.

Updates ongoing.

ps. Which is it, Maven? A plugin or a mojo?

No comments: