It occured to me that Cocoon could probably benefit from a Javascript Reader. This JS Reader would do what a normal resource reader would, unless the user specifies a compression-method parameter. If the compression method is supported, then the JS will be compressed. Right now, I think we can only use JSMin[1] or Package[4], as Dojo ShrinkSafe[2] and YUI compressor [3] rely on custom version of Rhino. Packer [4] is written in plain old javascript. JSMin and Packer are open source, but it is not distributed on any Maven repositories that I can see, so we would need to include them in source.

This would be useful for the (very large) JS dependencies in CForms (though, it could be argued that we should be bundling the already compressed version of Dojo and the other Cocoon JS files).

I, personally, would find something like this really useful as we have lots of code that we like to keep uncompressed for development, but compress at runtime.

What does everyone think? I don't mind coding this up (using just JSMin).

Apologies if something like this already exists.


[1] http://www.crockford.com/javascript/jsmin.html
[2] http://dojotoolkit.org/docs/shrinksafe
[3] http://developer.yahoo.com/yui/compressor/
[4] http://dean.edwards.name/packer/src/

Reply via email to