This will load all js or coffee files in the gulp directory to load all gulp tasks, so you don’t have to manually import new gulp tasks, just create anygalleryask.js inside '/ gulp' and you can use it from the command line.
Another advantage of this is that you don't have a huge gulpfile.js with millions of tasks and lines of code, since instead you have anygulptask.js for TASK, it's just good practice because gulpfile grows pretty fast
Gulpfile.js example
'use strict';
var gulp = require('gulp');
var wrench = require('wrench');
wrench.readdirSyncRecursive('./gulp').filter(function (file) {
return (/\.(js|coffee)$/i).test(file);
}).map(function (file) {
require('./gulp/' + file);
});
gulp.task('default', ['clean'], function () {
gulp.start('build');
});
YOUR PACKAGE STRUCTURE
gulp/
build.js
whatevergulptask.js
...
source
share