I have gulpfile.js and package.json in the root directory of the project, but the gulp task itself is not:
Проекта Project Root Directory
📄 gulpfile.js
📁 some_folder
📁 gulp_tasks
1. task1.js
2. task2.js
📄 webpack.js
To download tasks, I use this function:
function LazyRequireTask(taskName, path, options) { options = options || {}; options.taskName = taskName; gulp.task(taskName, function(callback){ let task = require(path).call(this, options); return task(callback); }); } Sample loading task:
LazyRequireTask('pug to html', 'some_folder/gulp_tasks/pug2html.js'); Webpack is one of the gulp task. Webpack and other gulp tasks take some_folder/gulp_tasks/ as the root directory of the project, and this raises a number of problems, but I want to save this organization of tasks. How can I explicitly specify the root directory of the project for all gulp tasks? (In the case of the webpack webpack this will be different).