gulp-hub
v4.2.0
Published
A gulp plugin to run tasks from multiple gulpfiles
Downloads
36,757
Maintainers
Readme
gulp-hub
Gulp extension to run tasks from multiple gulpfiles.
Basic Usage:
Install gulp-hub:
$ npm install gulp-hub
Create a gulpfile.js which looks like this:
var gulp = require('gulp'); var HubRegistry = require('gulp-hub'); /* load some gulpfiles into the registry */ var hub = new HubRegistry(['./project1/gulpfile.js', './project1/gulpfile.js']); /* tell gulp to use the tasks just loaded */ gulp.registry(hub);
Run
gulp [taskname]
Gulp will execute [taskname] in all of the gulpfiles.
More Details:
HubRegistry constructor accepts glob patterns. Tasks registered in the same gulpfile from which gulp-hub is called will be included. If one of the child gulpfiles also uses HubRegistry then that is handled too.
Use gulp --tasks to view the task tree:
gulp --tasks
gulp-hub/examples$ gulp --tasks
[15:56:21] Loading /Users/frank/work/gulp-hub/examples/project1/gulpfile.js
[15:56:21] Loading /Users/frank/work/gulp-hub/examples/project1/project1A/gulpfile.js
[15:56:21] Loading /Users/frank/work/gulp-hub/examples/project1/project1B/gulpfile.js
[15:56:21] Loading /Users/frank/work/gulp-hub/examples/project2/gulpfile.js
[15:56:21] Tasks for ~/work/gulp-hub/examples/gulpfile.js
[15:56:21] ├─┬ build
[15:56:21] │ └─┬ <series>
[15:56:21] │ ├─┬ /Users/frank/work/gulp-hub/examples/project1/gulpfile.js-build
[15:56:21] │ │ └─┬ build
[15:56:21] │ │ └─┬ <series>
[15:56:21] │ │ ├─┬ /Users/frank/work/gulp-hub/examples/project1/project1A/gulpfile.js-build
[15:56:21] │ │ │ └─┬ build
[15:56:21] │ │ │ └─┬ <series>
[15:56:21] │ │ │ ├── precompile
[15:56:21] │ │ │ └── compile1A
[15:56:21] │ │ ├─┬ /Users/frank/work/gulp-hub/examples/project1/project1B/gulpfile.js-build
[15:56:21] │ │ │ └─┬ build
[15:56:21] │ │ │ └─┬ <series>
[15:56:21] │ │ │ ├── precompile
[15:56:21] │ │ │ └── compile
[15:56:21] │ │ └─┬ /Users/frank/work/gulp-hub/examples/project1/gulpfile.js-internal-build
[15:56:21] │ │ └─┬ build
[15:56:21] │ │ └─┬ <series>
[15:56:21] │ │ ├── precompile
[15:56:21] │ │ └── compile
[15:56:21] │ ├─┬ /Users/frank/work/gulp-hub/examples/project2/gulpfile.js-build
[15:56:21] │ │ └─┬ build
[15:56:21] │ │ └─┬ <series>
[15:56:21] │ │ ├── precompile
[15:56:21] │ │ └── compile
[15:56:21] │ └─┬ /Users/frank/work/gulp-hub/examples/gulpfile.js-internal-build
[15:56:21] │ └─┬ build
[15:56:21] │ └─┬ <series>
[15:56:21] │ ├── precompile
[15:56:21] │ └── compile
See the example project for more advanced examples.