Some days ago, Google released the Google Closure Tools, that look very promising. I’ve yet been unable to feel particular enthusiasm for the Google Closure Library which seems like just another JavaScript (-only)? libary, something that may only be of any importance because it’s coming from Google, but who does not seem to provide anything really spectacular or new.
The Closure Compiler, however looks really good. It’s not only a simple script compressor, but also offering dead code removal and lint-like feature. I’ve been doing some testing with our main JavaScript bundle(all JavaScript code used in our test application concatenated together):
Description | Bytes abs | Bytes % |
---|---|---|
js bundle | 284935 | 100,0% |
yuicompressor compressed | 126656 | 44.5% |
closure compiler compressed | 97362 | 34.2% |
js bundle gzip | 75163 | 26.4% |
yui + gzip | 42189 | 14.8% |
closure + gzip | 35432 | 12.4% |
As you can see, Closure compiler is a bit better than yuicompressor. The only downside to it is that it doesn’t support IE conditional comments. This means that above numbers a little too good for Google Closure as we are using some IE conditional comments for compatibility purposes.
The depedency management looks promising, too. So far I am using a self-brew solution for my current project at work, but I would really like to see a standard for packaging, compression and deployment for Javascript.