run-sequence
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
chalk | 1.1.3 | 5.11 kB | MIT | prod | |
fancy-log | 1.3.3 | 2.65 kB | MIT | prod | |
plugin-error | 0.1.2 | 3.77 kB | MIT | prod |
The "run-sequence" is a useful npm package designed to run a series of dependent gulp tasks in a specified order. This functionality helps to resolve situations where you have a defined run order but opt not to, or can't use dependencies. It must be noted, however, that this solution is temporary and can be seen as a hack. "run-sequence" functions by listening to the task_stop
and task_err
events and keeping track of which tasks have been completed. Although you still have the capability to run some tasks concurrently via providing an array of task names for one or more of the arguments.
To use "run-sequence", you first need to install it as an advancement dependency with the command, npm install --save-dev run-sequence
. Once installed, you can use it in your gulpfile as shown in the following code:
const gulp = require('gulp');
const runSequence = require('run-sequence');
const del = require('del');
const fs = require('fs');
gulp.task('build', function(callback) {
runSequence('build-clean', ['build-scripts', 'build-styles'], 'build-html', callback);
});
// Add configuration for 'build-clean', 'build-scripts', 'build-styles', and 'build-html' tasks
It's important to note that the tasks must return a stream or promise or handle the callback to ensure they're completed.
With complex gulp setups where tasks are split across different files, you may encounter an error where "run-sequence" is unable to find your tasks. In such situations, you can configure "run-sequence" to look at the gulp within the submodule like this:
const gulp = require('gulp');
const runSequence = require('run-sequence').use(gulp);
runSequence('subtask1', 'subtask2');
The "run-sequence" documentation can be found on its GitHub repository at git://github.com/OverZealous/run-sequence.git. The readme file contains all the necessary information you need to understand the tool's function and usage. It provides detailed usage examples with explanatory comments to help understanding how to utilize "run-sequence" in your project.