Created
October 9, 2016 22:06
-
-
Save fguisso/6d5f1d8480c55d7e9e9ce318b145b495 to your computer and use it in GitHub Desktop.
Gulp config for require all tasks from a gulp-tasks dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gulp = require('gulp'); | |
const path = require('path'); | |
const fs = require('fs'); | |
const tasks = fs.readdirSync('./gulp-tasks/'); | |
let tasksName = []; | |
tasks.forEach( (task, i) => { | |
const taskName = task.split('.')[0]; | |
tasksName[i] = taskName; | |
require(path.join(__dirname, 'gulp-tasks', task)); | |
}); | |
gulp.task('default', tasksName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment