You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/getting-started/3-creating-tasks.md
+32-8
Original file line number
Diff line number
Diff line change
@@ -160,17 +160,18 @@ exports.build = series(
160
160
);
161
161
```
162
162
163
-
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. Tasks can be wrapped with the [async-once][async-once] module if this **(not recommended)** pattern is needed.
163
+
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.
164
+
165
+
If you have code like this:
164
166
165
167
```js
166
-
// This pattern is NOT recommended but some edge cases might require it.
If nothing is returned from your task, you must use the error-first callback to signal completion. The callback will be passed to your task as the only argument - named `done()` in the examples below.
82
+
If nothing is returned from your task, you must use the error-first callback to signal completion. The callback will be passed to your task as the only argument - named `cb()` in the examples below.
83
83
84
84
```js
85
-
functioncallbackTask(done) {
86
-
// `done()` should be called by some async work
87
-
done();
85
+
functioncallbackTask(cb) {
86
+
// `cb()` should be called by some async work
87
+
cb();
88
88
}
89
89
90
90
exports.default= callbackTask;
@@ -93,9 +93,9 @@ exports.default = callbackTask;
93
93
To indicate to gulp that an error occurred in a task using an error-first callback, call it with an `Error` as the only argument.
94
94
95
95
```js
96
-
functioncallbackError(done) {
97
-
// `done()` should be called by some async work
98
-
done(newError('kaboom'));
96
+
functioncallbackError(cb) {
97
+
// `cb()` should be called by some async work
98
+
cb(newError('kaboom'));
99
99
}
100
100
101
101
exports.default= callbackError;
@@ -106,8 +106,8 @@ However, you'll often pass this callback to another API instead of calling it yo
Copy file name to clipboardexpand all lines: docs/getting-started/5-working-with-files.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ exports.default = function() {
35
35
}
36
36
```
37
37
38
-
`dest()`is given an output directory string which is generally used as a terminator stream. When it receives a file passed through the pipeline, it writes the contents and other details out to the filesystem at a given directory. The `symlink()` method is also available and operates like `dest()`, but creates links instead of files (see [`symlink()`][symlink-api-docs] for details).
38
+
`dest()` is given an output directory string and also produces a [Node stream][node-streams-docs] which is generally used as a terminator stream. When it receives a file passed through the pipeline, it writes the contents and other details out to the filesystem at a given directory. The `symlink()` method is also available and operates like `dest()`, but creates links instead of files (see [`symlink()`][symlink-api-docs] for details).
39
39
40
40
Most often plugins will be placed between `src()` and `dest()` using the `.pipe()` method and will transform the files within the stream.
41
41
@@ -61,9 +61,9 @@ exports.default = function() {
61
61
62
62
## Output in phases
63
63
64
-
`dest()` can be used in the middle of a pipeline to write intermediate states to the filesystem. When a file is received, the current state is written out to the filesystem, the path is updated to represent the new location of the output file, then that file is passed down the pipeline.
64
+
`dest()` can be used in the middle of a pipeline to write intermediate states to the filesystem. When a file is received, the current state is written out to the filesystem, the path is updated to represent the new location of the output file, then that file continues down the pipeline.
65
65
66
-
This feature can be useful to create an unminified and minified file with the same pipeline.
66
+
This feature can be useful to create unminified and minified files with the same pipeline.
0 commit comments