我有一个吞咽任务,看起来像这样:
gulp.task('htmlServer', ['bower'], function(cb) {
return gulp.src(config.build.htmlServerFiles, {base: './'})
.pipe(gulp.dest(config.build.build));
});它只是移动一些文件。bower任务对这些文件进行了一些适当的更改。
gulp.task('bower', ['jadeServer'], function() {
gulp.src(path.join(config.build.basepath, 'public/index.html'))
.pipe(wiredep({
directory: path.join(config.build.basepath, 'public/bower_components/'),
bowerJson: require(path.join(config.build.basepath, './bower.json'))
}))
.pipe(gulp.dest(path.join(config.build.basepath, 'public')));
});不幸的是,htmlServer任务似乎移动了在bower任务进行更改之前已经存在的文件的一个版本。
我做错了什么?我不能就地更改文件吗?
发布于 2015-11-12 02:25:04
您的“bower”任务必须返回其已构建的管道,否则它无法发出何时完成的信号,因此这些任务将并行运行。
请参阅https://github.com/gulpjs/gulp/blob/master/docs/recipes/running-tasks-in-series.md中的第二个示例
var gulp = require('gulp');
var del = require('del'); // rm -rf
gulp.task('clean', function() {
return del(['output']);
});
gulp.task('templates', ['clean'], function() {
var stream = gulp.src(['src/templates/*.hbs'])
// do some concatenation, minification, etc.
.pipe(gulp.dest('output/templates/'));
return stream; // return the stream as the completion hint
});https://stackoverflow.com/questions/28785101
复制相似问题