Skip to content

Instantly share code, notes, and snippets.

@xkr47
Created August 3, 2016 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xkr47/afb8c24b2783e185caa9f10502476aff to your computer and use it in GitHub Desktop.
Save xkr47/afb8c24b2783e185caa9f10502476aff to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var util = require('gulp-util');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var through2 = require('through2');
var plumber = require('gulp-plumber');
var errs = 0;
gulp.task('default', function () {
return gulp.src('./src/*.js')
.pipe(plumber(function plumberr(e) {
console.log("plumberr", e);
++errs;
}))
.pipe(through2.obj(function w(chunk, enc, cb) {
console.log("w()");
this.push(chunk);
//cb();
cb(new Error("thruuu", "lolMID"));
}, function e(cb) {
this.push(null);
cb();
}))
.pipe(gulp.dest('./target/'))
.pipe(plumber.stop())
.pipe(through2.obj(function we(chunk, enc, cb) {
cb();
}, function ee(cb) {
cb(errs && new util.PluginError("custom", "Lol"));
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment