Hi Kamal

One of the items on my (long) list of jobs to get done, in my re- working of CForms/Dojo is compression/minifying/packaging etc.

There are a number of different scenarios that I can imagine people will want to for it, but TBH, I have not thought it all through yet ....

1) development : uncompressed/un-minified, each 'class' loads separately
2) production (a) : single compressed/minified js file containing just the dojo and cforms code to support one cform, application or site. 3) production (b) : single compressed/minified js file containing just the cforms code to support one cform, application or site, with dojo loaded from CDN. 4) production (c) : load everything from CDN (i.e. arrange to put versionned CForms JS in eg. http://code.google.com/apis/ajaxlibs/) no idea if they'd be up for it .....

As I said, I have not looked into this very closely yet, but I assumed the first level of support would be documentation on how to use Dojo's built-in compressor within Cocoon manually, with support in the XSLT to allow a developer to specify a specific js file to load instead of all of individual dojo/cforms.

I think you need a config file to drive dojo's compressor. It would be interesting to see if this could be automated by a maven or ant build task.

regards Jeremy

On 12 Jul 2008, at 05:24, Kamal wrote:

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