I am trying to reuse my gulp tasks in two different projects. I am extracting my gulp tasks to the parent directory and trying to execute them. Here is my directory structure.
parent/ gulp-tasks/ default.js project1/ node_modules/ gulpfile.js js/ project2/ node_modules/ gulpfile.js js/
That is all I have in my gulpfile.js in every project
var requireDir = require('require-dir'); requireDir('../gulptasks');
This is what my default.js looks like:
var gulp = require('gulp'); gulp.task('default', function() {
When I try to run gulp default , I understand that gulp is undefined. I know that there are no node_modules in the parent directory, but is there a way to point to node_modules in each of the child projects? I donβt really want to get an answer about gulp, but how do I structure my projects to make my code reusable?
jhamm source share