gulp.task('default',['index','detail','pavilion'],function () {}多任务并发执行时只执行一个任务?
来源:9-3 如何打包发布-2
wibc666
2017-08-08
var gulp = require('gulp');
var rev = require('gulp-rev');
var revReplace = require('gulp-rev-replace');
var useref = require('gulp-useref');
var filter = require('gulp-filter');
var uglify = require('gulp-uglify');
var csso = require('gulp-csso');
gulp.task('index',['pavilion'],function () {
var jsFilter = filter(['**/*.js'],{restore:true});
var cssFilter = filter(['**/*.css'],{restore:true});
var htmlFilter1 = filter(['**/*','!**/index.html'],{restore:true});
gulp.src('wap/index.html')
.pipe(useref())
.pipe(jsFilter)
.pipe(uglify())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe(csso())
.pipe(cssFilter.restore)
.pipe(htmlFilter1)
.pipe(rev())
.pipe(htmlFilter1.restore)
.pipe(revReplace())
.pipe(gulp.dest('dist'));
console.info('index');
});
gulp.task('detail',function () {
var jsFilter = filter(['**/*.js'],{restore:true});
var cssFilter = filter(['**/*.css'],{restore:true});
var htmlFilter = filter(['**/*','!**/product_detail.html'],{restore:true});
gulp.src('wap/tmpl/product_detail.html')
.pipe(useref())
.pipe(jsFilter)
.pipe(uglify())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe(csso())
.pipe(cssFilter.restore)
.pipe(htmlFilter)
.pipe(rev())
.pipe(htmlFilter.restore)
.pipe(revReplace())
.pipe(gulp.dest('dist/tmpl'));
console.info('detail');
});
gulp.task('pavilion',function () {
var jsFilter = filter(['**/*.js'],{restore:true});
var cssFilter = filter(['**/*.css'],{restore:true});
var htmlFilter2 = filter(['**/*','!**/pavilion.html'],{restore:true});
gulp.src('wap/tmpl/pavilion.html')
.pipe(useref())
.pipe(jsFilter)
.pipe(uglify())
.pipe(jsFilter.restore)
.pipe(cssFilter)
.pipe(csso())
.pipe(cssFilter.restore)
.pipe(htmlFilter2)
.pipe(rev())
.pipe(htmlFilter2.restore)
.pipe(revReplace())
.pipe(gulp.dest('dist/tmpl'));
console.info('pavilion');
})
gulp.task('default',['index','detail','pavilion'],function () {
console.info(111);
})
1回答
-
姜维
2017-08-24
那个数组主要是任务的依赖任务,依赖任务会依次执行
00
相似问题