Skip to content

Commit 4b118b9

Browse files
GAumalaphated
authored andcommitted
Docs: Fix and improve Transform example in writing-a-plugin docs
1 parent 4f9465a commit 4b118b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/writing-a-plugin/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Transform streams are streams that are readable and writable; they manipulate ob
2222

2323
All gulp plugins essentially boil down to this:
2424
```js
25-
var Transform = require('transform');
25+
var Transform = require('stream').Transform;
2626

2727
module.exports = function() {
2828
// Monkey patch Transform or create your own subclass,
@@ -44,7 +44,7 @@ module.exports = function() {
4444
};
4545
```
4646

47-
Many plugins use the [through2](https://github.com/rvagg/through2/) module to simplify their code:
47+
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:
4848

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

0 commit comments

Comments
 (0)