简体   繁体   中英

Gulp task dependency

I would like to run (and complete) my "clean" task before running the rest of my build task.

This currently works, although "run" is deprecated and I'd like to replace it:

gulp.task('build', ['clean'],function() {
    gulp.run(['styles-nomaps','usemin','scripts','assets']);
});

What's the proper syntax?

您可以使用run-sequence插件。

You can use rimraf util to clean files, it can be run in sync mode:

clean.js:

var gulp = require('gulp');
var rimraf = require('rimraf');

gulp.task('clean', function(cb) {
  rimraf.sync(paths.assets, cb); // Make sure you pass callback
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM