Thomas E Jenkins wrote:
> Here are some links on reducing the number of requests to improve performance.
> 
> http://yuiblog.com/blog/2006/11/28/performance-research-part-1/
> 
> http://developer.yahoo.net/blog/archives/2007/04/rule_1_make_few.html
> 
> http://developer.mozilla.org/en/docs/Tips_for_Authoring_Fast-loading_HTML_Pages#Minimize_the_number_of_files
> 
> To highlight another view on JS optimization, I just finished a
> project for which I used the Dojo toolkit's build infrastructure.  It
> is certainly Dojo centric though it will work non-Dojo Javascript.
> 
> http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/package-system-and-custom-builds
> 
> It has a concept of layers so you can push common javascript into a
> single compressed file with page specific parts compressed into
> separate files.  For JS using the Dojo package system it will only
> pull in packages that are actually used.  So if you implement a widget
> for your site that only uses Dojo's Dialog widget you will only have
> Dialog and it's dependencies in your newly combined and compressed JS
> file.

Zope has some fancy stuff for combining resources transparently, and it 
has generally bugged the hell out of me.  Probably Dojo is less 
transparent, and more sensible as a result.

> Their build uses ShrinkSafe, a patched copy of the Mozilla Rhino jar,
> and their own JS glue code.  Despite the complexity it was simple to
> use, however on the whole I would say it fails the easy-to-install
> test pretty badly and really only makes sense for sites using Dojo.

Except for shrinking, it all is pretty simple stuff -- find the files, 
concatenate them, run the shrinker.  The WebHelper distutils extension 
is okay, but could be better, e.g., make it easier to define what files 
are compressed where, and easier for that to be confirmed by the <link> 
generating code.

Part of the problem is fitting the configuration in setup.cfg.  Maybe it 
should be a separate config file referred to by setup.cfg, like:

   [main.js]
   combine = file1.js file2.js file3.js
   shrink = true
   # shinker = yui, jsmin, shrinksafe, etc

   [main.css]
   combine = file1.css file2.css

   [extra.js]
   combine = file4.js file5.js
   shrink = true


Then have the combiner write out something that indicates what files 
were combined to where, and have something like:

   link_javascripts(['file1.js', 'file3.js'])

And it would produce as many <link> tags as necessary to make sure all 
those files are available (and also use some debug flag).


-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to