Run the gulp task from another node.js script

I am using a script as follows:

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 node run.js : node run.js

I need this because I need to collect some data through inquirer.prompt() before starting the task.

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

I do not understand why. If I run the task through gulp, that's fine.

+5
source share
1 answer

As mentioned in AperΓ§u's comments, try gulp to know that you have completed your task.

Change

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

to

 gulp.task('zip', function (done) {done()}); 
+1
source

Source: https://habr.com/ru/post/1207867/


All Articles