Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: node_js
node_js:
- "0.9"
- "0.10"
- "0.11"
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,42 @@ var baz = lazypipe().pipe(streamD).pipe(foo).pipe(streamE);

```

## using with argument functions like [gulp-if](https://github.com/robrich/gulp-if)

Lazypipe assumes that all function parameters are static, gulp-if arguments need to be instantiated inside each lazypipe. This difference can be easily solved by passing a function on the lazypipe step

```js
var gulpif = require('gulp-if');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');

var compressing = false;

var jsChannel = lazypipe()
// adding a pipeline step
.pipe(jshint) // notice the stream function has not been called!
.pipe(jshint.reporter)
// adding a step with an argument
.pipe(jshint.reporter, 'fail')
// you can't say: .pipe(gulpif, compressing, uglify)
// because uglify needs to be instantiated separately in each lazypipe instance
// you can say this instead:
.pipe(function () {
return gulpif(compressing, uglify());
});
// why does this work? lazypipe calls the function, passing in the no arguments to it,
// it instantiates a new gulp-if pipe and returns it to lazypipe.

gulp.task('scripts', function () {
return gulp.src(paths.scripts.src)
.pipe(jsChannel())
.pipe(gulp.dest(paths.scripts.dest));
});
```

[source](https://github.com/robrich/gulp-if/issues/32)


## API

### `lazypipe()`
Expand Down