views:

487

answers:

1

According to the official release statement version 1.4 has been re-written to be compressed with Closure Compiler yet when I use the online version of closure compiler I get 130 warnings.

This is the code I use.

// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// @code_url http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js
// ==/ClosureCompiler==

And as far as I know you get the real benefit of Closure Compiler if you include the library with your code also, so it removes the unused functions. Yet my testings show that I can't get any further than compressing the library itself..

What am I doing wrong? Any kind of insight will be much appreciated.

+5  A: 

jQuery 1.4 is compatible with the Closure Compiler, but only with the SIMPLE_OPTIMIZATIONS setting. The official minified version of jQuery is actually compiled with this setting, and this reduces the file size by 13%. Quote from this commit comment by John Resig:

Switched from using YUI Compressor to Google Compiler. Minified and Gzipped filesize reduced to 22,839 bytes from 26,169 bytes (13% decrease in filesize).

moff
and according to google http://code.google.com/closure/compiler/docs/compilation_levels.htmlonly advance optimization removes dead code.
Mohammad