Skip to content

Commit

Permalink
Docs: Fix and improve Transform example in writing-a-plugin docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GAumala authored and phated committed Dec 13, 2017
1 parent 4f9465a commit 4b118b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/writing-a-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Transform streams are streams that are readable and writable; they manipulate ob

All gulp plugins essentially boil down to this:
```js
var Transform = require('transform');
var Transform = require('stream').Transform;

module.exports = function() {
// Monkey patch Transform or create your own subclass,
Expand All @@ -44,7 +44,7 @@ module.exports = function() {
};
```

Many plugins use the [through2](https://github.com/rvagg/through2/) module to simplify their code:
Alternatively you could pass your transform and flush functions to the `Transform` constructor or even extend `Transform` with ES6 classes, as described by the [Node.js docs](https://nodejs.org/docs/latest/api/stream.html#stream_implementing_a_transform_stream). However, many plugins prefer to use the [through2](https://github.com/rvagg/through2/) module to simplify their code:

```js
var through = require('through2'); // npm install --save through2
Expand Down

0 comments on commit 4b118b9

Please sign in to comment.