Sunday, 19 March 2017

Gulp task finishing too early

I am struggling with my gulp script exiting too early.

I narrowed down the problem to this:

var gulp = require("gulp");
var through = require("through2");

function Transform() {
    return through.obj(function(file,enc,next) {
        // not calling next(null,file)
    });
}

gulp.task("test",function() {
    return gulp.src("foo")
        .pipe(Transform())
        .pipe(gulp.dest("tmp"));
});

Running gulp test, i would expect gulp never to exit since the stream should be blocked in the Transform operation that never pass the file down. But it returns.

There is obviously something i missed. What is it ?



via Blue4Whale

No comments:

Post a Comment