[dojo-contributors] Fwd: Using Dojo 1.6 with Closure -- document attached
Stephen.Chung at intexact.com
Wed Mar 2 22:27:22 EST 2011
Not sure if emailing to dojo_dev will work...
In response to your question, I have only tested it with a mobile
application that I made, which uses Dojo, dijit.Dialog and dojox.mobile.
Normal build, compressed with Closure simple mode: 373KB (100KB
Closure special build:
211KB (72KB gzipped)
Uglify should yield a similar compression ratio as Closure in simple mode.
Currently I have not been able to remove "dojo" without substantial changes
to the source tree. It can be done, but the changes will be more tricky, in
particular dealing with statements like:
d.addOnLoad[(dca instanceof Array ? "apply" : "call")](d, dca);
Any one of these statements automatically creates an alias to "dojo",
preventing optimization to everything underneath. Many of the Dojo
functions do not rely on "this" being set to "dojo", so it is probably safe
to pass null as the context to these calls, but they all have to be checked.
Other things (such as replacing dojo.mixin with individual assignments) are
quick and simple to implement.
As a result, the Closure special build does not eliminate much from Dojo
Core, unless the core source files are modified more extensively. I believe
that, when Dojo moves to an all-AMD module style, it will be much easier to
transform the Dojo sources file into a format that can readily be processed
From: Alex Russell
Sent: Thursday, 03 March, 2011 2:23 AM
To: dojo dev.
Cc: Stephen Chung
Subject: Re: [dojo-contributors] Fwd: Using Dojo 1.6 with Closure --
This is *outstanding* work!
Perhaps I just missed it, but what's the average code-size savings for
Stephen's builds vs. the regular Dojo build system?
On Mar 2, 2011, at 5:38 AM, Kris Zyp wrote:
> Stephen Chung has been researching the possibility of using Closure's
> advanced mode on Dojo to create highly compressed builds that eliminate
> dead code, and shorten property names. Attached is a document detailing
> his results. This could be very helpful in guiding our decisions about how
> to achieve extremely compact Dojo applications.
> -------- Original Message --------
> Subject: Using Dojo 1.6 with Closure -- document attached
> Date: Tue, 1 Mar 2011 13:06:57 +0800
> From: Stephen Chung <Stephen.Chung at intexact.com>
> Organization: Intexact Technologies
> To: Kris Zyp <kzyp at dojotoolkit.org>
> Hi Kris,
> I have put together a TODO document (attached) detailing how to use Dojo
> 1.6 with the Closure Compiler.
> Please help take a look, and perhaps put in on somewhere that people who
> wants to know how to do this can get some references.
> - Stephen
> <Using the Dojo Toolkit with the Closure Compiler.pdf><Dojo Closure
> dojo-contributors mailing list
> dojo-contributors at mail.dojotoolkit.org
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.872 / Virus Database: 271.1.1/3478 - Release Date: 03/03/11
More information about the dojo-contributors