Compiling with Closure
Closure is a JavaScript optimizing compiler (targetting optimized JavaScript) by Google. For a very good introduction to closure see this blog article.
Illegal boolean value –js problem
I am trying to compile the following:
java -jar compiler.jar –compilation_level=ADVANCED_OPTIMIZATIONS –third_party –js=jquery.js –js=snippet-one.js –js=jquery-ui.js –js=jquery.debug.js –js=snippet-two.js –js=jajax.js –js=jstorage.js –js=jcompress.js –js=jquery.windowframe.js –js=jquery.treeview.min.js –js=jquery.bgiframe.js –js=jquery.dimensions.js –js=jquery.tooltip.min.js –js=jquery.json-2.2.min.js –js=js_debug_toolbar.js –js=CFInstall.min.js –externs=snippet-three.js –js=visualisation.js –externs=snippet-four.js –js_output_file=__output.js
Which results in this error:
Illegal boolean value: –js
I merged the js files by hand into one big file and tried this:
java -jar compiler.jar –compilation_level=ADVANCED_OPTIMIZATIONS –third_party –js=jquery_one.js –externs=externs.js –js_output_file=output.js
Which still results in the same error:
Illegal boolean value: –js
The solution to this problem: you need to specify the –third_party tag with true, like this:
java -jar compiler.jar –compilation_level=ADVANCED_OPTIMIZATIONS –third_party=true –js jquery_one.js –externs externs.js –js_output_file output.js
Compiling JQuery with advanced optimizations does not work
Yes, it does not work! See this website for details.
We need to switch back one optimisation level for the script to work again …:
java -jar compiler.jar –compilation_level=SIMPLE_OPTIMIZATIONS –third_party=true –js=jquery.js –js=snippet-one.js –js=jquery-ui.js –js=jquery.debug.js –js=snippet-two.js –js=jajax.js –js=jstorage.js –js=jcompress.js –js=jquery.windowframe_patched.js –js=jquery.treeview.min.js –js=jquery.bgiframe.js –js=jquery.dimensions.js –js=jquery.tooltip.min.js –js=jquery.json-2.2.min.js –js=js_debug_toolbar.js –js=CFInstall.min.js –externs=snippet-three.js –js=visualisation.js –externs=snippet-four.js –js_output_file=__output2.js