在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):OverZealous/run-sequence开源软件地址(OpenSource Url):https://github.com/OverZealous/run-sequence开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):run-sequenceRuns a sequence of gulp tasks in the specified order. This function is designed to solve the situation where you have defined run-order, but choose not to or cannot use dependencies.
Each argument to If the final argument is a function, it will be used as a callback after all the functions are either finished or an error has occurred.
UsageFirst, install npm install --save-dev run-sequence Then add use it in your gulpfile, like so (note these are only examples, please check the documentation for your functions for the correct way to use them): var gulp = require('gulp');
var runSequence = require('run-sequence');
var del = require('del');
var fs = require('fs');
// This will run in this order:
// * build-clean
// * build-scripts and build-styles in parallel
// * build-html
// * Finally call the callback function
gulp.task('build', function(callback) {
runSequence('build-clean',
['build-scripts', 'build-styles'],
'build-html',
callback);
});
// configure build-clean, build-scripts, build-styles, build-html as you wish,
// but make sure they either return a stream or promise, or handle the callback
// Example:
gulp.task('build-clean', function() {
// Return the Promise from del()
return del([BUILD_DIRECTORY]);
// ^^^^^^
// This is the key here, to make sure asynchronous tasks are done!
});
gulp.task('build-scripts', function() {
// Return the stream from gulp
return gulp.src(SCRIPTS_SRC).pipe(...)...
// ^^^^^^
// This is the key here, to make sure tasks run to completion!
});
gulp.task('callback-example', function(callback) {
// Use the callback in the async function
fs.readFile('...', function(err, file) {
console.log(file);
callback();
// ^^^^^^^^^^
// This is what lets gulp know this task is complete!
});
}); Using within gulp submodulesIf you have a complex gulp setup with your tasks split up across different files, you may get the error that // submodule tasks/mygulptask.js
var gulp = require('gulp'), // might be a different instance than the toplevel one
// this uses the gulp you provide
runSequence = require('run-sequence').use(gulp);
// ...and then use normally
runSequence('subtask1', 'subtask2'); OptionsThere are a few global options you can configure on the Please note these are global to the module, and once set will affect every use of Usage: var runSequence = require('run-sequence');
runSequence.options.ignoreUndefinedTasks = true;
gulp.task('task', function(cb) {
runSequence('foo', null, 'bar'); // no longer errors on `null`
})
LICENSE |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论