Steve
Steve

Reputation: 14922

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?

Upvotes: 3

Views: 922

Answers (2)

alexmac
alexmac

Reputation: 19617

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
});

Upvotes: 1

Neal
Neal

Reputation: 3179

You can use the run-sequence plugin.

Upvotes: 1

Related Questions