我正在使用gulp-notify插件。这是我如何在gulpfile.js中实现它的一个例子(你可以看到我也使用了gutil和livereload,我不知道他们是否有任何影响因素,但是如果他们这样做,请告诉我。)如何防止gulp-notify在Windows中破坏gulp-watch?
gulp.task('js', function() {
return gulp.src('./dev/scripts/*.coffee')
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./build/js'))
.pipe(notify('Coffeescript compile successful'))
.pipe(livereload(server));
});
此插件适用于OS X和Linux。在没有通知功能的Windows上,它会返回一个错误并打破gulp-watch插件。这是我已经吞下手表设置的例子:
gulp.task('watch', function() {
server.listen(35729, function (err) {
if (err) {
return console.log(err);
}
gulp.watch('./dev/scripts/*.coffee',['js']);
});
});
所以,我的文档中读取一饮而尽管插件可以帮助在Windows上时,我不会打破一饮而尽手表,但我无法找到我如何在像这样的设置中使用它的例子。
现在一饮而尽,通知静静地失败,与选项,如果你以抓住错误选择。请参阅选项emitError(https://github.com/mikaelbr/gulp-notify#optionsemiterror) – mikaelb