floatdrop / gulp-plumber

Fixing Node pipes
MIT License
806 stars 32 forks source link

Provide a convenience function that would patch the gulp.src #44

Closed gajus closed 7 years ago

gajus commented 8 years ago
import plumber from 'gulp-plumber';

export default (gulp, plumberOptions = {}) => {
    let gulpSrc;

    gulpSrc = gulp.src;

    return (...args) => {
        return gulpSrc
            .apply(gulp, args)
            .pipe(plumber(plumberOptions))
    };
};

Then user can simply do:

import gulp from 'gulp';
import {
    patchGulpSrc
} from 'gulp-plumber';

gulp.src = patchSrc(gulp);
floatdrop commented 7 years ago

Combining streams to handle errors is possible workaround for this. I strongly believe that gulp should handle this internally.