gulp-do
Directory-based, promisified task management for Gulp
Installation
npm install --save-dev gulp-do
Usage
gulp-do does two things:
- Loads and registers tasks automatically from a directory of files.
- Enables promise-based task dependency management.
By default, gulp-do loads tasks from the /gulp
directory. Each file in the directory should export a function that will be passed to gulp.task
. The name of the task will be taken from the name of the file If the task is asynchronous, the function should return a promise.
// gulpfile.jsvar gulp = ;var task = ; task;
// gulp/foo.jsmodule { return { console; ; };};
// gulp/bar.jsvar gulp = ;var task = ; module { task;};
Then from the command line:
$ gulp bar
[18:38:20] Using gulpfile ~/Projects/foodie/gulpfile.js
[18:38:20] Starting 'bar'...
foo
[18:38:20] Finished 'bar' after 706 μs
bar
API
var task = ;
task.configure(gulp, [options])
Call this once in your gulpfile, passing an instance of gulp. The only valid option right now is taskDir
, which defaults to ./gulp
. If options
is a string instead of an object, it overrides taskDir
.
task.do(taskname, [taskArgs...])
Perform task. Returns a promise that resolves when task is complete.
task.get(taskname)
Returns function for task.
License
MIT