Is it possible to have one main gulpfile.js from which to call tasks from other gulp files.js? Simple "require" of child gulpfile.js into main one doesn't work. I have a platform project which includes several sub projects with separate gulpfiles, so I need a solution to manage all child gulpfiles from within main one
It is possible to have one main gulpfile.js from which to call tasks from other gulp files.js using the require-dir
module. From the projects README use it like this:
If your gulpfile.js
is starting to grow too large, you can split the tasks into separate files by using the require-dir module.
Imagine the following file structure:
gulpfile.js tasks/ ├── dev.js ├── release.js └── test.js
Install the require-dir
module:
npm install --save-dev require-dir
Add the following lines to your gulpfile.js
file.
var requireDir = require('require-dir'); var dir = requireDir('./tasks');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With