Split tasks across multiple files

If your gulpfile.js is starting to grow too large, you can split the tasks into separate files by using the gulp-hub module as a custom registry.

Imagine the following file structure:

├── dev.js
├── release.js
└── test.js

Install the gulp-hub module:

npm install --save-dev gulp@next gulp-hub

Add the following lines to your gulpfile.js file:

'use strict';

var gulp = require('gulp');
var HubRegistry = require('gulp-hub');

/* load some files into the registry */
var hub = new HubRegistry(['tasks/*.js']);

/* tell gulp to use the tasks just loaded */

This recipe can also be found at https://github.com/frankwallis/gulp-hub/tree/4.0/examples/recipe

Last Updated: 8/11/2018, 4:54:05 PM