V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wtz
V2EX  ›  前端开发

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

  •  
  •   wtz · 2015-06-30 10:37:07 +08:00 · 1943 次点击
    这是一个创建于 3242 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    1 条回复    2015-06-30 11:48:10 +08:00
    ccccccc
        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)
    })
    })
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1064 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:30 · PVG 03:30 · LAX 12:30 · JFK 15:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.