Gulp Sass with errLogToConsole: true still stops my other tasks

I currently have 3 monitoring tasks:

gulp.task('watch', function(){ + '/*.scss', ['sass']); + '/*.css', ['css']); + '/*.js', ['js']);


My problem right now is that when Sass throws an error, all view tasks stop. Then I added .pipe(sass({errLogToConsole: true}))

- which seems to keep my sass watch task pending even with an error, however the other two watch tasks don't seem to work.

How do I keep all my viewing tasks live so that a bug in my sass file doesn't prevent everything from compiling?

My setup:

gulp.task('sass', function () {
    gulp.src(sassDir + '/**/*.scss')
        .pipe(sass({errLogToConsole: true}))

gulp.task('css', function() {
  gulp.src(cssDir + '/**/*.css')
            browsers: ['last 40 versions'],
            cascade: false
    .pipe(rename({suffix: '.min'}))

gulp.task('js', function() {
  gulp.src(jsDir + '/**/*.js')
    .pipe(rename({suffix: '.min'}))

gulp.task('watch', function(){ + '/*.scss', ['sass']); + '/*.css', ['css']); + '/*.js', ['js']);

gulp.task('default', ['sass','css','js','watch']);



source to share

1 answer

errLogToConsole is deprecated (or doesn't work) since Gulp 2.0+. Try using this instead .pipe(sass({errLogToConsole: true}))


.pipe(sass().on('error', sass.logError))


I use this with watch command and the errors are not stopped by Gulp.

I got this from the Gulp example code and a few more modern Gulp tutorials. Check here in the future.



All Articles