我正在试图找出为什么我的gulp任务没有按照我想要的顺序运行,这是代码;
gulp.task('styles', ['clean-styles'], function () {
log('Compiling Less --> CSS');
return gulp
.src(config.less)
.pipe($.less())
.pipe($.autoprefixer({browsers: ['last 2 version', '> 5%']}))
.pipe(gulp.dest(config.temp));
});
gulp.task('clean-styles', function (done) {
var files = config.temp + '**/*.css';
clean(files, done);
});
function clean(path, done) {
log('Cleaning: ' + $.util.colors.blue(path));
del(path, done);
}
当我运行'gulp styles'时,它只运行'clean-styles'函数,它应该在完成clean任务后运行'styles'函数。
简而言之,问题是;
为什么我的'样式'任务在执行时会被忽略?
提前致谢
答案 0 :(得分:0)
尝试这个:
//An array of tasks to be executed and completed before your task will run.
gulp.task('clean-styles', ['styles'], function() {
// Do stuff
});