Configuring jawr to use YUI compressor instead of JSMinifier for minifying js files

Jawr is the framework that is developed to make the versioning, compression, minifying css, js files  more stream lined. It can also be integrated with smartsprites and people can write their custom handlers for their application needs. I am not here to explain about various features supported by jawr. Please go to the link mentioned above for more details.

JSMin is the default post processor used by jawr, it is too old, does not understand some semantics and bothers you throwing errors during minifying process, or the minified version has some bugs which are not present if you set debug mode to true.

So the other option is YUI Compressor,  Jawr identifies which post processor to use based on jawr.js.bundle.factory.bundlepostprocessors property in it is defaulted to JSMin if none is specified. We can set the property to YUI to notify jawr to use YUI compressor instead. Download YUI Compressor from please use latest version 2.4.7 as the previous versions has some class loading issues with Rhino.  Do not include rhino in your application's lib directory to avoid conflicts with the same namespace used by both the jars.

Your will look something like this.

# Common properties
jawr.js.bundle.factory.bundlepostprocessors= YUI

Compile, make war and deploy it on the server and see that previously thrown js errors were gone and application runs smoothly. Let me know if you find any difficulty in configuring it.


Popular posts from this blog

Proper way to have an anchor tag with onclick event

CORS issues with IE9 and workarounds

My FIRE Journey