Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 1.18 KB

arguments.md

File metadata and controls

48 lines (41 loc) · 1.18 KB

docs - API - CLI - REPL - logging - arguments

Task arguments

Any of the task runners (gulp.start, gulp.series, gulp.parallel and gulp.stack) can be used to pass arguments down.

var gulp = require('gulp-runtime').create();
var args = [1, 2, 3];

gulp.task(':name', function (done, one, two, three) {
  console.log(one, two, three);
  done(null, one + two + three);
});

// with gulp.stack
gulp.stack('taskNameHere')(1, 2, 3, function (error, result) {
  if (error) {
    console.log('ups, who farted?');
    console.log(error.stack);
  } else {
    console.log('all right, we are done at', result, 'pm today');
  }
});

// with gulp.start
gulp.task('default', function (done) {
  gulp.start(['taskNameHere'], 1, 2, 3, {
    onStackEnd: function (error, result) {
      if (error) {
        console.log('ups, who farted?');
        console.log(error.stack);
      } else {
        console.log('all right, we are done at', result, 'pm today');
      }
      done();
    }
  })
});

Back to top ↑