Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is jQuery 1.4.2 compatible with Closure Compiler?

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.

like image 385
Mohammad Avatar asked Feb 04 '26 18:02

Mohammad


1 Answers

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).

like image 104
moff Avatar answered Feb 06 '26 09:02

moff