Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run gulp tasks from a node script

Tags:

node.js

gulp

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' 
like image 635
alcala Avatar asked Feb 12 '15 15:02

alcala


People also ask

How do I run a gulp task?

in the Before launch area and choose Run Gulp task from the list. In the Gulp task dialog that opens, specify the Gulpfile. js where the required task is defined, select the task to execute, and specify the arguments to pass to the Gulp tool. Specify the location of the Node.

How do I run gulp locally?

Install Gulp into your local project To install Gulp locally, navigate to your project directory and run npm install gulp . You can save it to your package. json dependencies by running npm install gulp --save-dev . Once you have Gulp installed locally, you can then proceed to create your gulpfile.


2 Answers

Eventually I found the way:

gulp.start('default'); 
like image 101
alcala Avatar answered Sep 18 '22 07:09

alcala


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' ] ); 
like image 39
Oh Xyz Avatar answered Sep 20 '22 07:09

Oh Xyz