wtz

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

  •  
  •   wtz · Jun 30, 2015 · 2634 views
    This topic created in 3976 days ago, the information mentioned may be changed or developed.

    代码如下:
    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 replies    2015-06-30 11:48:10 +08:00
    ccccccc
        1
    ccccccc  
       Jun 30, 2015
    试试

    gulp.task('copyfonts',function(){
    return gulp.src(staticConfig['fonts'] + '/')
    .pipe(gulp.dest('./dist/fonts/'))
    .on('error', function(e) {
    console.log(e)
    })
    })
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1167 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 23:05 · PVG 07:05 · LAX 16:05 · JFK 19:05
    ♥ Do have faith in what you're doing.