gulp-foreach

Send each file in a stream down its own stream

Either use gulp-tap or gulp-flatmap, depending on your needs
Last updated 6 years ago by mariusgundersen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-foreach 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.1.0                                ...           latest (6 years ago)

3 Versions

  • 0.1.0 [deprecated]           ...           6 years ago
  • 0.0.1 [deprecated]           ...           6 years ago
  • 0.0.0 [deprecated]           ...           6 years ago

Copyright 2014 - 2016 © taobao.org |