node npm gulp 中有没有办法监听 task 执行成功或者失败的状态

2015-06-30 10:37:07 +08:00
 wtz

代码如下:
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 是否成功执行??

1957 次点击
所在节点    前端开发
1 条回复
ccccccc
2015-06-30 11:48:10 +08:00
试试

gulp.task('copyfonts',function(){
return gulp.src(staticConfig['fonts'] + '/')
.pipe(gulp.dest('./dist/fonts/'))
.on('error', function(e) {
console.log(e)
})
})

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/202098

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX