var gulp = require('gulp');
var config = require('./gulp.config')();
var $ = require('gulp-load-plugins')({ lazy: true });
gulp.task('styles', function () {
log('Compiling Less --> CSS');
return gulp
.src(config.less)
.pipe($.plumber())
.pipe($.less())
.pipe($.autoprefixer({ browsers: ['last 3 versions', '> 5%'] }))
.pipe(gulp.dest(config.styles));
});
gulp.task('less-watcher', function () {
gulp.watch([config.less], ['styles']);
});
当我在.less文件上创建错误时,我收到错误,但观察者挂起,如果我修复了错误,我需要重启观察者。我以为这是由水管工处理的......?
答案 0 :(得分:1)
问题出在return
关键字中。删除它以使水管工工作正常!
gulp.task('styles', function () {
log('Compiling Less --> CSS');
gulp.src(config.less)
.pipe($.plumber())
.pipe($.less())
.pipe($.autoprefixer({ browsers: ['last 3 versions', '> 5%'] }))
.pipe(gulp.dest(config.styles)); });