node.js - How do I require a directory in a node_module? -
to make gulpfile.js easier read, put of gulp tasks in gulp/ directory. thing in gulpfile.js require in whole directory this:
var requiredir = require('require-dir'); requiredir('./gulp'); an example task file `default.js'
gulp.task('default', function() { // stuff here }); i use same gulp stuff in multiple projects, create npm module , packaged of gulp tasks it. when try change gulpfile.js point @ directory same contenxt in node_modules this:
var requiredir = require('require-dir'); requiredir('./node_modules/my-gulp/gulp'); it doesn't find of tasks. same directory before, why won't work? can pull in multiple gulp tasks in manner?
Comments
Post a Comment