I have written couple of articles on Google's Closure Compiler:
In terms of Javascript Compression, the most widely used tools are: JSMIN, the DOJO Compressor, Dean Edwards’ Packer and YUI Compressor. The YUI Compressor is designed to be 100% safe and yield a higher compression ratio than the other tools listed above. That’s why most of the JavaScript Frameworks use YUI Compressor to minimize their Javascript code.
On November 5th, Google announced Closure Compiler for Javascript compression. The strongest part of the Closure Compiler is that it does not only remove whitespace but also it rewrites Javascript Code to make it smaller. It also optimizes your Javascript code to perform better.
In this post, I compared the compression performance of YUI Compressor and Google Closer Compiler using the well-known Javascript Frameworks - Mootools, JQuery and Prototype:
The comparison results show that Google Closure Compiler with advanced selected as compression level minimizes code size about 20-25% more than YUI Compressor by providing nearly 60% compression.
Currently rated 5.0 by 2 people
November 9. 2009 16:26
Pingback from topsy.com Twitter Trackbacks for Closure Compiler vs. YUI Compressor - Comparing the Javascript Compression Tools [bloggingdeveloper.com] on Topsy.com
topsy.com | Reply
November 9. 2009 16:31
Social comments and analytics for this post This post was mentioned on Twitter by bloggingdev: Closure Compiler vs. YUI Compressor - Comparing the Javascript Compression Tools http://su.pr/1DqQMr
uberVU - social comments | Reply
November 10. 2009 14:12
The closure Advanced method replace function names with shorter names. I think it is hard to use in production.
DictZone | Reply
November 10. 2009 15:01
Actually, it is impossible to edit compressed Javascript. But before going to production, you can compress your code and use it only in production.
blogging developer | Reply
November 10. 2009 15:27
Ok. Thanks for it. I have the problem is in the html: <form ... onsubmit="myFunc()"... <select onchange="myEvent()"... You are right. If I make it from javascript, it is not problem. E.g.: document.forms[0].onsubmit = ... But I have more problem :-( : I have a template engine. In the template engine there are some javascript variable. The variable value is set in the html template. e.g.: var chars=[$chars]; checkCookies('$cookiemiss'); // depends on user language In this case, closure rename my variables in js code, but not in html.
November 10. 2009 18:37
@Dictzone: A bonus of using Google's closure over the YUI compressor is that closure actually has a firebug plugin that allows you to more easily debug the compressed code (in Firefox at least).
Mattyp | Reply
November 11. 2009 09:49
@Mattyp - Yes, I found it The solution for my problem is: var cookiemiss = '$cookiemiss'; // in html function checkCookies() { // in js alert(cookiemiss); }
November 19. 2009 16:51
I'm using jQuery since 2007, this is awesome and let me write really compact JS code even for complex projects. Past July I downloaded the YUI compressor but honestly until now I didn't use it (I develop some 3 projects by month with Ajax & rich content) so it make me ask: how much useful is a compressor in our real lives? I love Google projects but I tried Closure and I think it adds complex to a simple way to do things.
Oscar | Reply
December 26. 2009 19:23
Like your writing! Still you can do some things to improve it.
cash loans | Reply
March 2. 2010 15:37
Im just wondering how risky is the advanced mode and why would i ever want simple/whitespaces modes at all? Maybe someone has some experience with large javascript codebases and closure compiler to boost the performance? YUI compressor worked for me well so far just need to make sure its safe to use advanced mode : )
Artur Ejsmont | Reply