Split tasks across multiple files
gulpfile.js is starting to grow too large, you can split the tasks into separate files using one of the methods below.
Be advised, that this approach is considered deprecated and could lead to problems when migrating to the
You can use the gulp-require-tasks module to automatically load all your tasks from the individual files.
Please see the module's README for up-to-date instructions.
You can also use the require-dir module to load your tasks manually.
Imagine the following file structure:
gulpfile.js tasks/ ├── dev.js ├── release.js └── test.js
npm install --save-dev require-dir
Add the following lines to your
var requireDir = require('require-dir'); var tasks = requireDir('./tasks');