Skip to content
This repository has been archived by the owner on Dec 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request gulpjs#1429 from kevdez/master
Browse files Browse the repository at this point in the history
Fixed docs on gulp.task's optional arguments & provided a better example
  • Loading branch information
phated committed Dec 9, 2015
2 parents 000fa65 + d0bfef3 commit 0a4d96b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Default: `0777`

Octal permission string specifying mode for any folders that need to be created for output folder.

### gulp.task(name[, deps], fn)
### gulp.task(name [, deps, fn])

Define a task using [Orchestrator].

Expand All @@ -119,6 +119,7 @@ gulp.task('somename', function() {
```

#### name
Type: `String`

The name of the task. Tasks that you want to run from the command line should not have spaces in them.

Expand All @@ -135,7 +136,7 @@ gulp.task('mytask', ['array', 'of', 'task', 'names'], function() {

**Note:** Are your tasks running before the dependencies are complete? Make sure your dependency tasks are correctly using the async run hints: take in a callback or return a promise or event stream.

You can also omit the function if you only want to run the dependency tasks:
You can also omit the function if you only want to run a bundle of dependency tasks:

```js
gulp.task('build', ['array', 'of', 'task', 'names']);
Expand All @@ -144,8 +145,21 @@ gulp.task('build', ['array', 'of', 'task', 'names']);
**Note:** The tasks will run in parallel (all at once), so don't assume that the tasks will start/finish in order.

#### fn
Type: `Function`

The function that performs the task's operations. Generally this takes the form of `gulp.src().pipe(someplugin())`.
The function performs the task's main operations. Generally this takes the form of:

```js
gulp.task('buildStuff', function() {
// Do something that "builds stuff"
var stream = gulp.src(/*some source path*/)
.pipe(somePlugin())
.pipe(someOtherPlugin())
.pipe(gulp.dest(/*some destination*/));

return stream;
});
```

#### Async task support

Expand Down

0 comments on commit 0a4d96b

Please sign in to comment.