dkdf
dkdf

Reputation: 81

Start gulp task from another node.js script

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.

Upvotes: 5

Views: 3310

Answers (1)

Codebling
Codebling

Reputation: 11382

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()});

Upvotes: 1

Related Questions