This package has been deprecated

Author message:

Either use gulp-tap or gulp-flatmap, depending on your needs

gulp-foreach

0.1.0 • Public • Published

gulp-foreach

Send each file in a stream down its own stream

Install

$ npm install --save-dev gulp-foreach

Usage

var gulp = require('gulp');
var foreach = require('gulp-foreach');
 
gulp.task('default', function () {
  return gulp.src('src/*.js')
    .pipe(foreach(function(stream, file){
      return stream
        .pipe(doSomethingWithEachFileIndividually())
        .pipe(concat(file.name));
    }))
    .pipe(gulp.dest('dist'));
});

API

The foreach method takes one argument, a function. This function is called once for each file piped to foreach and is passed a stream as its first argument and the file as its second argument. The stream contains only one file.

You can optionally return a stream from the foreach function. All the streams returned from foreach will be combined and their contents will be emited by foreach.

License

MIT © Marius Gundersen

Package Sidebar

Install

npm i gulp-foreach

Weekly Downloads

5,731

Version

0.1.0

License

MIT

Last publish

Collaborators

  • mariusgundersen