Answer the question
In order to leave comments, you need to log in
Why are task modules not included in the main gulpfile?
I'm trying to include files with tasks in the main gulpfile via require-dir, but for some reason it doesn't work. Tell me what am I doing wrong?
const requireDir = require('require-dir');
requireDir('./gulp/tasks/');
module.exports.start = series(scripts, pug2html);`
Answer the question
In order to leave comments, you need to log in
Found a solution that I don't like.
But it really works.
You need to wrap the function itself in gulp.task like:
'use strict';
const { src, dest, task } = require('gulp');
const less = require('gulp-less');
task('styles', function () {
return src('./src/styles/main.less')
.pipe(less())
.pipe(dest('./build/css'));
});
'use strict';
const {
src,
dest,
watch,
series,
parallel,
lastRun,
task } = require('gulp');
const requireDir = require('require-dir');
requireDir('./tasks');
task('default', parallel('html', 'styles'));
can you give a little more details? gulp version? contents of files in tasks? something writes in the console?
apparently, requireDir returns to nowhere and is not processed in any way, you can try to do it like here:
https://github.com/thienhung1989/angular-tree-dnd/...
or do it without require-dir:
gulp.tasks = require('./gulp/tasks/')().tasks;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question