Lars Trieloff wrote: > Hi Christopher, > > as the individual JS files are rather small, the most costly part is > requesting them from the web server, not downloading them. With an > aggregated file, there is only one single request. > > I agree that it does not make sense to create a JS file per form > because that would result in redundant downloads, so the only > possibility is to have it configured at build time. > > What about creating a src/main/js directory where all contained *.js > files will be aggregated into a single $projectname.js file?
That would create a central location for all JS files in the system, that would go against the modularization in blocks. What we actually need is a way for each block to expose its JS files (we already have that with the "_cocoon/resources/*/**" matcher) and a "dojo dependency file". The aggregation of all these files actually makes the Dojo profile needed by the application [1] and can be directed to the Dojo compressor. This process can happen either at build-time (but requires an additional step for users) or at runtime with the DojoReader you suggested, whose first run would be quite costly but can aggressively cache its result. Sylvain [1] http://archive.dojotoolkit.org/nightly/buildscripts/profiles/ -- Sylvain Wallez - http://bluxte.net
