Any ideas on how to use the Google Closure Compiler to merge multiple javascript files without any optimizations?

Any ideas on how to use the Google Closure Compiler to combine multiple JavaScript files without any optimizations? In particular, we want to use Closure to deploy two versions of our combined JavaScript site: release and debugging. For release, we use --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies , which works as intended. However, for debugging, we would like our JavaScript to be merged intact / unmodified to simplify debugging. It seems that the minimum level of optimization is WHITESPACE_ONLY , any ideas would be appreciated.

+6
javascript google-closure-compiler
source share
4 answers

Refuses to format the processed JavaScript file using --formatting PRETTY_PRINT . The indents / formats option (with a space) displays a JavaScript file, so JavaScript is easily debugged.

The desire for documentation is a bit more / full :)

+2
source share
 --formatting PRETTY_PRINT for beautifying --debug true for meaningful names (after Advanced compilation) 
+4
source share

Concatenation works as you expect:

 java -jar compiler.jar --js 1.js --js 2.js --js_output_file out.js 
+4
source share

Two thoughts immediately come to mind. First, why use the closure compiler for this task, why not just something like cat jsfile1.js jsfile2.js > debug.js ? Second, the Closure Inspector allows you to debug code compiled with the Closure Compiler using FireBug.

To help you work with the converted code, you can also install the Closure Inspector , a tool that simplifies the use of Firebug JavaScript Debugger with compiler output.

+2
source share

All Articles