end vs. finish
adam-lynch opened this issue · comments
I think using .on('end', done)
after gulp-size
will cause a dependent task not to run but using finish
will.
?
I mean I had something like this:
// ...
gulp.task('a', ['b'], function(){
console.log('1');
});
gulp.task('b', function(done){
gulp.src('./script.js')
// ....
.pipe(gzip()) //gulp-gzip
.pipe(size())
.on('end', done);
});
1
would not be printed to the console, but if it would if I had the following.
// ...
gulp.task('a', ['b'], function(){
console.log('1');
});
gulp.task('b', function(done){
gulp.src('./script.js')
// ....
.pipe(gzip()) //gulp-gzip
.pipe(size())
.on('finish', done);
});
Here is where I had this problem. Does this make sense?
The events differs, end
is on readable stream and finish
is on writable stream. This isn't really specific to gulp-size. I'd suggest you post a StackOverflow question if you need a better explanation ;)
Nah, that makes sense:). I've been putting off reading the stream handbook. It's time :)