create dynamically (at runtime) set of gulp tasks

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:

// Gulp 4

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)...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts