gulp.watch错误:写完了

时间:2014-08-01 14:01:49

标签: node.js gulp gulp-watch

我对不同的gulp.watch指令得到了不同的结果 当我执行watch任务并更改.html文件时,一切正常(下面定义的任务)

但是当我更改任何其他文件(.coffee,.less等)时,我收到此错误:

stream.js:94

      throw er; // Unhandled stream error in pipe.
        ^
Error: write after end
  at writeAfterEnd (/Users/oclement/Documents/phoenix/MedifastCerBrokenDown/MedifastWeb/AppSource/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:145:12)
  at Transform.Writable.write (/Users/oclement/Documents/phoenix/MedifastCerBrokenDown/MedifastWeb/AppSource/node_modules/gulp-filter/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:193:5)
  at Stream.ondata (stream.js:51:26)
  at Stream.emit (events.js:95:17)gulp.watch`

观看任务

gulp.task('watch', function() {
    isWatching = true;
    run('build', 'index', function() {
        g.util.log(g.util.colors.green('Starting to Watch'));
        gulp.watch('./app/**/*.html', ['templates']);
        gulp.watch('./app/**/*.coffee', ['phnxjs']);
        ...
    });
});

模板任务

gulp.task('templates', function(done) {
    g.util.log(g.util.colors.green('---TEMPLATES---'));
    sourceStreams.templates()
        .pipe(buildWatchPipe()())
        .pipe(g.ngHtml2js(options.templates))
        .pipe(g.concat(destinations.templates.bundleName))
        .pipe(g.if(isProd, transformScriptsProd()))
        .pipe(destinations.templates.target())
        .pipe(g.if(isWatching, g.livereload()));
    done();
});

Phnxjs任务

gulp.task('phnxjs', function(done) {
    g.util.log(g.util.colors.green('---PHNXJS---'));
    var wrapException = g.filter('!**/tags-input.js');

    sourceStreams.phoenixScripts()
        .pipe(buildWatchPipe()())
        .pipe(filters.coffee)
        .pipe(g.coffee(options.coffee))
            .on('error', g.util.log)
        .pipe(filters.coffee.restore())
        .pipe(wrapException)
            .pipe(iffeWrapper())
        .pipe(wrapException.restore())
        .pipe(g.if(!isProd, g.angularFilesort()))
        .pipe(g.if(isProd, transformScriptsProd()))
        .pipe(g.if(isProd, g.concat(destinations.phoenixScripts.bundleName)))
        .pipe(destinations.phoenixScripts.target())
        .pipe(g.if(isWatching, g.livereload()));

    done();
});

0 个答案:

没有答案