1 | # gulp-streamify [![NPM version](https://badge.fury.io/js/gulp-streamify.png)](https://npmjs.org/package/gulp-streamify) [![Build status](https://secure.travis-ci.org/nfroidure/gulp-streamify.png)](https://travis-ci.org/nfroidure/gulp-streamify)
|
2 | > Wrap old [Gulp](http://gulpjs.com/) plugins to support streams.
|
3 |
|
4 | It is pretty annoying when Gulp plugins doesn't support streams. This plugin
|
5 | allows you to wrap them in order to use the stream mode anyway. It is pretty
|
6 | useful when you want to take advantage of streams on part of your pipelines.
|
7 |
|
8 | *Note to gulp plugin developpers*: This plugin should not discourage you to
|
9 | support streams in your own plugins. I made this plug-in to avoid beeing
|
10 | stucked with a bad plugin. If your underlying library support streams, please,
|
11 | use it! Even if it doesn't, use
|
12 | [BufferStreams](https://npmjs.org/package/bufferstreams)
|
13 | in your plugins to support streams at the plugin level (it won't block files
|
14 | to buffer their contents like this library has to do to work). Here is a
|
15 | [sample of bufferstreams usage](https://github.com/nfroidure/gulp-ttf2eot/blob/master/src/index.js#L73)
|
16 | in Gulp plugins.
|
17 |
|
18 | ## Usage
|
19 |
|
20 | First, install `gulp-streamify` as a development dependency:
|
21 |
|
22 | ```shell
|
23 | npm install --save-dev gulp-streamify
|
24 | ```
|
25 |
|
26 | Then, add it to your `gulpfile.js` and wrap all that shit:
|
27 |
|
28 | ```javascript
|
29 | var gStreamify = require('gulp-streamify')
|
30 | , noStreamPlugin = require('gulp-no-stream')
|
31 | ;
|
32 |
|
33 | gulp.task('stream', function(){
|
34 | gulp.src(['**/*'])
|
35 | .pipe( gStreamify( noStreamPlugin() ) )
|
36 | .pipe(gulp.dest('/tmp'));
|
37 | });
|
38 | ```
|
39 |
|
40 | If you have several plugins to wrap together, prefer calling `gulp-streamify` once:
|
41 | ```javascript
|
42 | var gStreamify = require('gulp-streamify')
|
43 | , noStreamPlugin = require('gulp-no-stream')
|
44 | , noStreamPlugin2 = require('gulp-no-stream2')
|
45 | ;
|
46 |
|
47 | gulp.task('stream', function(){
|
48 | gulp.src(['**/*'])
|
49 | .pipe(gStreamify(
|
50 | noStreamPlugin().pipe(noStreamPlugin2())
|
51 | ))
|
52 | .pipe(gulp.dest('/tmp'));
|
53 | });
|
54 | ```
|
55 |
|
56 | ### Contributing / Issues
|
57 |
|
58 | You may want to contribute to this project, pull requests are welcome if you
|
59 | accept to publish under the MIT licence.
|