Gulp task with arguments (loop call wit another args)

88 views Asked by At

I wanna call gulp task with different argument or with changed data. For example: I have list (names). I need repeatedly (Array length) call task by rotation with list[index] item. Something, like:

var name = 'MyName',
    secondName = 'MySecondName';
var namesArr = ['Name1', 'Name2', 'Name3'];

gulp.task('default', function(name) {
   // do something with 'name'
});

gulp.task('cycle', function() {
   for (var i = 0; i < namesArrLength; i++) {
      geeer(name, packageName, i, 80000 * i);
   }

function geeer(name, packageName, index, time) {
    name = namesArr[index];
    secondName = namesArr[index];

    var interval = setTimeout(function () {
        gulp.start('default'); // I need call this task with new 'name' and 'secondName'
    }, time);
}
});
0

There are 0 answers