Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Second task in run-sequence doesn't run

Suppose I have the following task:

gulp.task('my-task', function (cb) {
    fs.appendFileSync('myPath', 'data');
});

When I do something like this:

gulp.task('build', function (cb) {
    runSequence('my-task', 'some-task',cb);
});

my-task runs and finishes, but some-task never runs.

My question is: how do I make some-task run after my-task has finished?

like image 264
Great Question Avatar asked Mar 06 '26 03:03

Great Question


1 Answers

Your problem is that gulp doesn't notice that my-task has finished. When you declare a callback function cb you have to actually call the callback:

gulp.task('my-task', function (cb) {
  fs.appendFileSync('myPath', 'data');
  cb();
});

Or you can leave the callback out entirely, since fs.appendFileSync is synchronous anyway:

gulp.task('my-task', function () {
  fs.appendFileSync('myPath', 'data');
});
like image 177
Sven Schoenung Avatar answered Mar 08 '26 16:03

Sven Schoenung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!