Google Closure Compiler Includes
I've been using google closure compiler for a little bit with my projects, it's awesome! I've been trying to find out whether or not you can do 'includes' in a javascript file that
Solution 1:
When Using Closure-Library
"Includes" are handled via goog.require calls. See https://developers.google.com/closure/library/docs/tutorial#zippy
In un-compiled code, the included scripts are dynamically inserted. During compilation, the compiler will include all the necessary scripts and dead-code elimination will remove the unused methods and symbols.
Other Options
The most popular option for handling JavaScript includes/dependencies is RequireJS. RequireJS does dynamic script insertion. Closure-compiler has a Common JS pass which translates RequireJS require
calls to goog.require
calls so that the compiler can then include them directly during compilation.
Post a Comment for "Google Closure Compiler Includes"