How to run gulp tasks from a node script

2019-03-17 06:24发布

问题:

I have a node script and I want to run a gulp task I have in the same script, how can I call it?

#!/usr/bin/env node
var gulp = require('gulp');
gulp.task('default', function (arg) {

});

// How do I call the task 'default'

回答1:

Eventually I found the way:

gulp.start('default');


回答2:

Use an array in start method, in the case someone is looking for a way of running multiple tasks from search engines.

gulp.start( [ 'task1', 'task2' ] );


标签: node.js gulp