Hi,
I am trying to create dynamically (at runtime) set of gulp tasks and after that I want to execute them.
So the default task executes in series task called ‘createTasks’ which I thought would create all my tasks in array ‘tasks’ and then execute the function returned by ‘gulp.series(tasks)’.
But it generates the error:
‘VM40 assert.js:42 Uncaught AssertionError: One or more tasks should be combined using series or parallel’
The code looks like this:
var gulp = require('gulp');
var tasks = [];const fileArray = ['task1', 'task2'];
debugger;gulp.task('createTasks', function(done) { for (var key in fileArray) { gulp.task(fileArray[key], function(done) { console.log("I was called"); }); tasks.push(fileArray[key]); }});
gulp.task('default', gulp.series('createTasks', gulp.series(tasks)));
What am doing wrong?
Kind Regards,
Janusz