Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start gulp task from another node.js script

Tags:

node.js

gulp

I'm using script like this:

run.js:

var gulp = global.gulp  = require('gulp');
require('./gulpfile.js');

//interaction
gulp.start('zip');

gulpfile.js:

global.gulp = global.gulp || require('gulp');

gulp.task('zip', function () {});

And start: node run.js

I need it because I need collect some data via inquirer.prompt() before task start.

Everything works, but console freeze cursor after script end(in PHPStorm).

I don't understand why. If I run task via gulp, it's ok.

like image 970
dkdf Avatar asked Nov 10 '22 22:11

dkdf


1 Answers

As mentioned by Aperçu in the comments, try letting gulp know that you're done your task.

Change

gulp.task('zip', function () {});

to

gulp.task('zip', function (done) {done()});
like image 145
Codebling Avatar answered Nov 14 '22 22:11

Codebling