Skip to content

Instantly share code, notes, and snippets.

@jbeard4
Last active December 15, 2015 13:19
Show Gist options
  • Save jbeard4/5266451 to your computer and use it in GitHub Desktop.
Save jbeard4/5266451 to your computer and use it in GitHub Desktop.
Using closure compiler to stitch commonjs modules together.
find ./lib -type d \( -path ./lib/rhino -o -path ./lib/node -o -path ./lib/browser/build \) -prune -o -name '*.js' -print | xargs java -jar ~/Downloads/compiler.jar --formatting=PRETTY_PRINT --process_common_js_modules --common_js_entry_module=lib/scion.js --output_wrapper '(function (root, scion) { if (typeof define === "function" && define.amd) { define(o); } else { root.scion = scion(); } }(this, function () { %output% return module$lib$scion;}));' > dist/combined.js
java -jar ~/Downloads/compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS dist/combined.js > dist/out.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment