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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -