代码如下:
gulp.task('copyfonts',function(){
return gulp.src(staticConfig['fonts'] + '/')
.pipe(gulp.dest('./dist/fonts/'));
})
然后我想监控 copyfonts 任务是否成功
gulp.task('aaa', ['copyfonts'],function(err){
console.log(err)
});
此时没有输出
假如改成一个不存在地址:
gulp.task('copyfonts',function(){
return gulp.src(staticConfig['foxxxnts'] + '/')
.pipe(gulp.dest('./dist/fonts/'));
})
还是没有输出!
问题是如何监控copyfonts 是否成功执行??
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
gulp的任务系统是基于orchestrator。提供了
start,stop,err,task_start,task_stop,task_err,task_not_found,task_recursion几个事件。可以像下面这样监听
也有现成的插件gulp-plumber来监听任务异常。