gulp-plumber: Fails on return

Hey there!

AWESOME πŸ’ patch, love it so much!

I noticed if I return the stream in a task, β€˜watch’ freezes after a stream error:

gulp.task('styles', function() {
    return gulp.src('application/static/style/*.scss')
        .pipe(plumber())
        .pipe(sass())
        .pipe(gulp.dest('public/static/style/'));
});

If I remove β€˜return’ it doesn’t freeze, when an error occurs:

gulp.task('styles', function() {
    gulp.src('application/static/style/*.scss')
        .pipe(plumber())
        .pipe(sass())
        .pipe(gulp.dest('public/static/style/'));
});

Returning the stream is mentioned in the gulp docs here: https://github.com/gulpjs/gulp/blob/master/docs/API.md#async-task-support

Thanks! πŸ˜ƒ

About this issue

  • Original URL
  • State: open
  • Created 10 years ago
  • Comments: 21 (3 by maintainers)

Commits related to this issue

Most upvoted comments

I had same issue with gulp-stylus. Emitting end from the custom error handler seems to fix it:

gulp.task('styles', function() {
    return gulp.src(paths.styles.src)
        .pipe(plumber(function(error) {
            gutil.log(gutil.colors.red(error.message));
            this.emit('end');
        }))
        .pipe(stylus({ use: [ nib() ] }))
        .pipe(concat('all.css'))
        .pipe(gulp.dest(buildDir + '/styles'));
});