0 votes
in JAVA by
What is gulp.task and how to use it?

1 Answer

0 votes
by
gulp.task registers the function with a name.In other words, it defines your tasks. Its arguments are name, deps and fn.

name: is of string type and it is name of the task. Tasks that you want to run from the command line should not have spaces in them.,

deps: An array of tasks to be executed and completed before your task will run. This is optional.

fn: is the function that performs the task’s main operations. This is also optional.

As mentioned, both deps and fn are optional but you must supply either deps or fn with the name argument. So, it has 3 forms.

gulp.task('mytask', function() {

  //do stuff

});

gulp.task('mytask', ['array', 'of', 'task', 'names']);

The tasks will run in parallel (all at once), so don’t assume that the tasks will start/finish in order.

gulp.task('mytask', ['array', 'of', 'task', 'names'], function() {

  //do stuff .

});

Related questions

0 votes
asked Feb 15, 2020 in JAVA by rahuljain1
+1 vote
asked Feb 15, 2020 in JAVA by rahuljain1
...