Build Script to wrap compiled closure-code into an AMD/UMD module.
- Change /src/goog.require.js to include the closure-library "classes" you need.
- Change name_of_module variable in build.py to whatever your module's name is.
- Run /build.py
- NOTE: You will need to install python if you don't already have it (http://www.python.org/getit/).
- The file will be written to /dist/closure-umd-<name_of_module>.js
- NOTE: This tool only does SIMPLE_OPTIMIZATIONS with the closure compiler you will still want to minify during your normal build step.
This was more of an experiment than anything else. There are probably many ways this process could easily get out of hand (duplication of functionality, file size, etc). That said, use at your own discretion.
I wanted to try closure-library's userAgent in a requirejs project. This was the method I came up with to allow any closure-library "class" to be used as AMD. However, In the end, I chose a smaller AMD library that better fit my needs.
Information on Google's Closure Library can be found at: https://developers.google.com/closure/library/