Tasks can be considered public or private.
- Public tasks are exported from your gulpfile, which allows them to be run by the
- Private tasks are made to be used internally, usually used as part of
A private task looks and acts like any other task, but an end-user can't ever execute it independently. To register a task publicly, export it from your gulpfile.
In the past, `task()` was used to register your functions as tasks. While that API is still available, exporting should be the primary registration mechanism, except in edge cases where exports won't work.
Gulp provides two powerful composition methods,
parallel(), allowing individual tasks to be composed into larger operations. Both methods accept any number of task functions or composed operations.
parallel() can be nested within themselves or each other to any depth.
To have your tasks execute in order, use the
For tasks to run at maximum concurrency, combine them with the
Tasks are composed immediately when either
parallel() is called. This allows variation in the composition instead of conditional behavior inside individual tasks.
parallel() can be nested to any arbitrary depth.
When a composed operation is run, each task will be executed every time it was referenced. For example, a
clean task referenced before two different tasks would be run twice and lead to undesired results. Instead, refactor the
clean task to be specified in the final composition.
If you have code like this:
Migrate to this: