what's the difference between using 'gulp default task' and 'run-sequence npm modules if i have two tasks to execute,the result was the same.so i have no idea why should use 'run-sequence'?
1.gulp default task
gulp.task('default',['task1','task2']);
2.'run sequence npm modules'
var runSequence = require('run-sequence');
gulp.task('default', function(callback) {
runSequence('task1', 'task2', callback);
});
i'm new in gulp,i saw the tutorial video online,and they teach to use 'run-sequence module' to advance the gulp skill,so i have got the question.
In the first case,
task1
andtask2
are ran in parallel. In the second case,task2
is ran aftertask1
finishes.You'd want to use
run-sequence
when a task depends on the result of another task.To achieve this in gulp@3, you can also express this with task dependencies :
Here
task1
is defined as a dependency fortask2
, sotask2
won't execute untiltask1
is finished.