
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
gulp-closure-compiler
Advanced tools
Gulp plugin for Google Closure Compiler
Issues with the output or Java should be reported on the Closure Compiler issue tracker.
npm install --save-dev gulp-closure-compiler
Simple optimizations for classic minifying.
var gulp = require('gulp');
var closureCompiler = require('gulp-closure-compiler');
gulp.task('default', function() {
return gulp.src('src/*.js')
.pipe(closureCompiler({
compilerPath: 'bower_components/closure-compiler/lib/vendor/compiler.jar',
fileName: 'build.js'
}))
.pipe(gulp.dest('dist'));
});
Advanced optimizations is much more aggressive. It's aimed for libraries like Closure Library.
var gulp = require('gulp');
var closureCompiler = require('gulp-closure-compiler');
gulp.task('default', function() {
return gulp.src('src/*.js')
.pipe(closureCompiler({
compilerPath: 'bower_components/closure-compiler/lib/vendor/compiler.jar',
fileName: 'build.js',
compilerFlags: {
closure_entry_point: 'app.main',
compilation_level: 'ADVANCED_OPTIMIZATIONS',
define: [
"goog.DEBUG=false"
],
externs: [
'bower_components/este-library/externs/react.js'
],
extra_annotation_name: 'jsx',
only_closure_dependencies: true,
// .call is super important, otherwise Closure Library will not work in strict mode.
output_wrapper: '(function(){%output%}).call(window);',
warning_level: 'VERBOSE'
}
}))
.pipe(gulp.dest('dist'));
});
The current version of the compiler doesn't need a deps file as it used to. Now you need to supply the directories where your dependencies are defined (via goog.provide).
var gulp = require('gulp');
var closureCompiler = require('gulp-closure-compiler');
gulp.task('default', function() {
return gulp.src(['main.js', 'src/**/*.js', 'bower_components/closure-library/closure/goog/**/*.js'])
.pipe(closureCompiler({
compilerPath: 'bower_components/closure-compiler/compiler.jar',
fileName: 'build.js',
compilerFlags: {
closure_entry_point: 'app.main',
compilation_level: 'ADVANCED_OPTIMIZATIONS',
only_closure_dependencies: true,
warning_level: 'VERBOSE'
}
}))
.pipe(gulp.dest('dist'));
});
Type: String
Required
Generated file name.
Type: String
Required
Path to compiler.jar
Type: Object
Closure compiler flags.
Type: Boolean
Tiered compilation enhances the speed of compilation. It's supported everywhere since Java 1.7+, but requires the installation of a JDK.
Type: Number
If the buffer returned by closure compiler is more than 1000kb, you will get an error saying "maxBuffer exceeded". To prevent this, you can set the maxBuffer to the preffered size you want (in kb).
Type: boolean
Ignore the warnings and continue with the compiler. This adds flexiblity to some projects that can't work around certain warnings. Default value is false.
Use Bower.
{
"name": "foo",
"version": "0.0.0",
"dependencies": {
"closure-compiler": "http://dl.google.com/closure-compiler/compiler-latest.zip"
}
}
MIT © Daniel Steigerwald
FAQs
Gulp plugin for Google Closure Compiler
We found that gulp-closure-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.