我正在使用 gulp 从 less 创建一些 css 并具有监视功能。当更少的文件没有错误时一切正常,手表正在调用更少的函数并编译css。但是,当我在较少的文件中出现错误时,请注意休息一下,说明错误停止的位置。当我修复较少文件中的错误时,手表不再工作。我要重新启动,能不能看看有没有错误继续看编译,这里是我的gulp.js
// Less to CSS task
var parentPath = './content/css/';
var sourceLess = parentPath;
var targetCss = parentPath;
gulp.task('less', function () {
return gulp.src([sourceLess + 'styles.less'])
.pipe(less({ compress: true }).on('error', gutil.log))
.pipe(autoprefixer('last 10 versions', 'ie 9'))
.pipe(minifyCSS({ keepBreaks: false }))
.pipe(gulp.dest(targetCss))
.pipe(notify('Less Compiled, Prefixed and Minified'));
});
gulp.task('watch', function () {
gulp.watch([sourceLess + 'styles.less'], ['less']); // Watch all the .less files, then run the less task
});