Package | gulp-dir2module |
Description | Creates a browserify/commonjs module with a map of all the files in a directory. |
Node Version | >= 0.10 |
var dir2module = require('gulp-dir2module');
gulp.task('dir2module', function() {
gulp.src('js/controllers/*.js')
.pipe(dir2module('controllers.js'))
.pipe(gulp.dest('js/controllers'))
});
This will create a file in the js/controllers directory called controllers.js that exports a map with each js file (excluding itself).