Opinionated Gulp task that minifies file with Google Closure Compiler.
Works with Gulp 4.
npm install --save-dev build-gc
// gulpfile.js
// For default and only task:
require('build-gc').default(
'src/index.js', // Source file to minify
'src/index.min.js', // Where to output minified result
'src/externs.js' // [optional] Closure Compiler externs
);
// Use it for specific task
const gulp = require('gulp');
const build_gc = require('build-gc');
gulp.task('minify', build_gc.minify(
'src/index.js', // Source file to minify
'src/index.min.js', // Where to output minified result
'src/externs.js' // [optional] Closure Compiler externs
))
Feel free to create issues and send pull requests (for big changes create an issue first and link it from the PR), they are highly appreciated!
Free Public License 1.0.0 / Zero Clause BSD License