Skip to content

Commit 9ed0b1c

Browse files
committed
Add explanation of the exports line in a gulpfile
1 parent 7d1858c commit 9ed0b1c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

04--writing-the-gulpfile.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ We establish a function, which we’ll also refer to as a task, called `compress
7171
2. Pipe, or send, the outputof all the HTML files to our `htmlCompressor` function, which, in turn, receives an object of options (a common Gulp feature) that collapses whitespace.
7272
3. Pipe the compressed HTML files, which are copies of the original files in the `uncompressed-html` folder, to the final destination: the `compressed-html` folder. If the folder doesn’t exist, the `dest` function will create it; the compressed files retain the names of the original files copied from the `compressed-html` folder.
7373

74+
## Last Line
75+
```javascript
76+
exports.compressHTML = compressHTML;
77+
```
78+
79+
And, finally, the last line in this `gulpfile` needs to expose the task to Gulp. The `compressHTML` component in `exports.compressHTML` is what is exposed to Gulp on the command line, and the `compressHTML` task in the `gulpfile` to the right of the assignment operator (`=`) is our local private task that is made public in the assignment. It’s common to assign the name of the local task to `exports` for public exposure to Gulp.
80+
7481
You’ve authored your first task.
7582

7683
§

0 commit comments

Comments
 (0)