Friday, 6 March 2009

If you want an online js and css minifyer go here and use ScriptMixer. The guys have wrapped the YUICompressor lib.

The offline version can also combine files whilst minifying and obfuscating js and css files too.

So to use in netbeans builds do this:-
1) Download the offline version from here,
2) Put it in your ant lib directory, windows default for nb 6.5 is 
     C:\Program Files\NetBeans 6.5\java2\ant\lib
3) For js combining, choose an include file name say compressed.js and use this as the include in your html/jsp files.

4) add something like the following to your project build.xml substituting the filename for your own:-

Job done, this has saved the overhead of 3 JS files by combining into one, making them smaller and obfuscating them, all automaticly in the build process.

Works a treat.