gulp里如何设置pipe里面的回调?

如题,

gulp.src(file)
    .pipe(dosomething)
    .pipe(function(callback()){
        dosomething has done
        callback()
    })
function callback(){
    another thing
}    

如题,gulp里面如何在一个管道任务结束后进行回调?

阅读 6.5k
1 个回答

这是什么意思?你要干嘛?

如果只是想在stream结束后做点事情,只要监听end事件就好了:

gulp.src(file)
    .pipe(dosomething)
    .on('end', callback);
    
function callback(){
    another thing
}