wtz

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

  •  
  •   wtz · Jun 30, 2015 · 2862 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:02:54 +08:00
    yangg
        1
    yangg  
       Jun 30, 2015
    一般的任务不检测,这种从配置中读的手动检测

    if(!fs.existsSync(cwd + f)) {
    throw new Error('File not found "' + cwd + f + '"');
    }
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1162 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 23:05 · PVG 07:05 · LAX 16:05 · JFK 19:05
    ♥ Do have faith in what you're doing.