First of all, this may seem a dumb/noob question, but I'm more of a backend developer and I don't really work with npm and node that often. I was just used to start gulp watch and I was ready to go theming/styling.
So i just upgraded to gulp 4 with node version 10. Ofcourse i'm getting the Task never defined: default
error. So i'm trying to migrate to gulp 4's way of defining tasks, but i can't just make it work with simple-task-loader. When i try a sample code, i'm getting gulp not defined. Here is the original old code gulpfile.js:
'use strict';
var gulp = require('gulp');
var taskLoader = require('gulp-simple-task-loader');
var plugins = require('gulp-load-plugins')();
var config = require('./config.json');
taskLoader({
taskDirectory: 'bower_components/gulp-tasks/tasks',
plugins: plugins,
config: config
});
And this is the default.js and watch.js from simple-task-loader
default.s:
'use strict';
module.exports = function(gulp, config, plugins) {
return function() {
return gulp.start(config.default_tasks);
};
};
watch.js:
'use strict';
module.exports = function(gulp, config, plugins) {
return function() {
config.production = false;
plugins.livereload.listen();
gulp.start(config.default_tasks);
config.default_tasks.forEach(function(task) {
if (config[task].watch) {
gulp.watch(config[task].watch, [task]);
} else {
gulp.watch(config[task].src, [task]);
}
})
return true;
};
};
When trying to use the new default.js code, I'm getting gulp not defined even though in the main gulpfile.js there is a require.
example new default.js:
exports.default = gulp.series(parallel(gulp, config, plugins));
gulp.task('default', gulp.series('start'));
Will return gulp not defined