检测闭包编译器的gulp插件

时间:2018-02-20 16:07:33

标签: gulp closures

我正在使用gulp和谷歌闭包编译器,例如:

var compilerPackage = require('google-closure-compiler');
var closureCompiler = compilerPackage.gulp();

gulp.task('js-compile', function () {
    return closureCompiler({
        js: './src/js/**.js',
        externs: compilerPackage.compiler.CONTRIB_PATH + '/externs/jquery-1.9.js',
        compilation_level: 'ADVANCED',
        warning_level: 'VERBOSE',
        language_in: 'ECMASCRIPT6_STRICT',
        language_out: 'ECMASCRIPT5_STRICT',
        output_wrapper: '(function(){\n%output%\n}).call(this)',
        js_output_file: 'output.min.js'
   })
  .src() // needed to force the plugin to run without gulp.src
  .pipe(gulp.dest('./dist/js'));
});

是否可以检测输出(警告和错误)?例如:

.on("error", function(err) {})
.on("warning", function(warn) {});

感谢您的帮助

0 个答案:

没有答案