[Cosmo-dev] Compact/compile Cosmo Javascript

Matthew Eernisse mde at osafoundation.org
Thu Nov 16 16:11:09 PST 2006


Here are some more details on optimizing Cosmo JS/CSS for speedy delivery:

1. Compiling

The 'compiling' process is basically just to concat the JS script files 
together. :) Dojo however is apparently working on a much more 
sophisticated JavaScript Linker which slices, dices, shines your shoes, 
etc.:

http://blog.dojotoolkit.org/2006/08/30/js-linker-in-dojo

2. Compression

These are the two most commmon compression utilities you see used to 
reduce JS file size:

ShrinkSafe

http://alex.dojotoolkit.org/shrinksafe/

JSMin

http://www.crockford.com/javascript/jsmin.html

3. HTML template files

We also have Dojo widget HTML template files that need to be sucked up, 
transformed into JS string variables, and shoved into the accompanying 
widget JS file -- otherwise you're making another connection just to 
pull in some scraps of HTML.

4. CSS files

Right now we are using a client-side 'dynamic CSS' approach which has 
everything in a single file, but requires processing on the browser and 
does some basic variable substitution. If we identify that dynamic CSS 
process as being a page-load bottleneck, we can pre-process that file 
too as part of a build into a static file for the production environment.


Matthew


Jared Rhine wrote:
> Mikeal Rogers wrote:
>> We might want to break this in to two items. One for reducing bandwidth
>> in general, and another for reducing round trips.
> 
> "Reduce bandwidth in general" seems too general for an actionable bug.  I
> filed it as one bug with the assumption that the implementation is just
> using Dojo's magic compiler, which will both unify files and do
> whitespace/comment stripping.
> 
> Since it just got targetted for 0.6, could someone provide a direct pointer
> to this compiler?  (To understand better what it does and how to use it)
> 
> I'd be interested to continue looking at bandwidth-specific investigations
> of all sorts.  This "compile JS" approach, if it pans out, seems like
> low-hanging fruit that will have such a dramatic impact as to suggest it be
> done first.
> 
> -- Jared
> _______________________________________________
> cosmo-dev mailing list
> cosmo-dev at lists.osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/cosmo-dev
> 



More information about the cosmo-dev mailing list