Skip to content

Instantly share code, notes, and snippets.

@formigone
Created April 1, 2015 12:11
Show Gist options
  • Save formigone/bd164f9bbb546854ef76 to your computer and use it in GitHub Desktop.
Save formigone/bd164f9bbb546854ef76 to your computer and use it in GitHub Desktop.
Gulp Closure Compiler - using closure library
// As of this writing, the example on https://github.com/steida/gulp-closure-compiler doesn't
// explain how to compile your project using Google's Closure Library.
// Since the newest version of the compiler doesn't need a deps file anymore, we just need
// to provide all our module definitions (files with goog.provide) to the task src.
gulp.task('build', function () {
// Specify where your Closure Library is stored --------------------------vvvv
gulp.src(['main.js', 'src/**/*.js', 'node_modules/closure-library/closure/goog/**/*.js'])
// Everything else is the same as in the docs
.pipe(closureCompiler({
compilerPath: '/usr/local/google-closure/compiler.jar',
fileName: 'dist/build.js',
compilerFlags: {
closure_entry_point: 'rokko.main',
compilation_level: 'ADVANCED_OPTIMIZATIONS',
define: [
"goog.DEBUG=false"
],
only_closure_dependencies: true,
warning_level: 'VERBOSE',
create_source_map: 'app.comp.js.map'
}
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment