Closure compiler is a javascript optimizing compiler.

Source: Internet
Author: User

Http://code.google.com/p/closure-compiler/

Http://stackoverflow.com/questions/28932/best-javascript-compressor

Google releasedClosure CompilerWhich seems to be generating the smallest files so far as seen hereand here

Previous to that the varous options were as follow

Basically Packer does a better job at initial compression, but if you are going to gzip the files before sending on the wire (which you shoshould be doing) Yui compressor gets the smallest final size.

The tests were done on jquery code BTW.

  • Original jquery library 62,885 bytes, 19,758 bytes after Gzip
  • Jquery minified with jsmin 36,391 bytes, 11,541 bytes after Gzip
  • Jquery minified with packer 21,557 bytes, 11,119 bytes after Gzip
  • Jquery minified with the Yui compressor 31,822 bytes, 10,818 bytes after Gzip

@ Daniel James mentions in the comment compressorrater which shows packer leading the chart in best compression, so I guess YMMV

Link | improve this answer Edited Nov 8' 09 Answered Aug 26 '08 at 19: 48pat
12.4k63365
 
  Packer has an option to 'base62 encode' off-and for jquery It compresses smaller than Yui after gzip. this is because jquery uses 'eval' and 'with 'which prevents 'safe' compressors from doing certain compressions, but packer ignores them. not safe in general but jquery is tested for Packer. -Daniel James sep 17 '08
  Also, try compressorrater.thruhere.net if you don't believe me.-Daniel James sep 17 '08
6  
Don't forget the downside to packer -- Decompression Time.-nosredna Jun 7' 09
1  
Wow, this tool is pretty awesome. * & ^ @ # $ !! Google, they provide so too things that it kind of makes me wary to use them, since they do nearly everything these days. they are taking over the world... -Jason Bunting Aug 24 '10
  Watch out, Google closure can sometimes be the worst compressor (output even larger than original)-It converts non-ASCII characters in strings\uxxxxLiterals by default... use e.g.--charset UTF-8(If you're sure you let the browser know about it somehow)-mykhal Feb 15
Closure Compiler

Closure compiler is a javascript optimizing compiler. it parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. it also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. it is used in memory of Google's JavaScript apps, including Gmail, Google Web search, Google Maps, and Google Docs.

Try it out!

It's easy to try the compiler through our web application at http://closure-compiler.appspot.com/

Get the Compiler

Download the compiler at http://closure-compiler.googlecode.com/files/compiler-latest.zip or using Maven.

The zip file contains a ReadMe with quick instructions to get you started.

User Documentation

You can read more about closure compiler at http://code.google.com/closure/compiler.

We also have a few low-key Wiki pages at http://code.google.com/p/closure-compiler/w/list. Please suggest new ones if you see anything missing.

Developer documentation

The closure compiler javadocs are available at http://closure-compiler.googlecode.com/svn/trunk/javadoc/index.html

You can browse the source at http://code.google.com/p/closure-compiler/source/browse/#svn/trunk

We accept Patches

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.