Gulp.js stops compiling LESS when watched after there has been an error in the LESS files

前端 未结 4 1491
孤城傲影
孤城傲影 2021-02-08 02:06

I\'m having a problem with gulp. I run gulp-watch along with gulp-less and gulp-clean. Everything is running perfectly.

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 02:24

    I always use gulp-plumber for my error catching. Works really easily and logs the error to the console.

    Example:

    gulp.task('less', function() {
        return gulp.src(['src/main/webapp/styles/main.less'], {base: 'src/main/webapp/styles/'})
        .pipe(plumber())
        .pipe(less().on('error', gutil.log))
        .pipe(gulp.dest('src/main/webapp/styles/build'))
        .on('error', function(err) {
            gutil.log(err);
            this.emit('end');
        });
    });
    

提交回复
热议问题