gulp-fn
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

gulp-fn

A simple function injection plugin for gulp

It allows to run custom callback functions in the gulp pipeline without having to deal with the NodeJS event-stream.

usage

Install npm package

npm install gulp-fn

Use it in your Node.js code

var gulp    = require('gulp');
var gulpFn  = require('gulp-fn');
 
gulp.task('hello_gulp-fn', function() {
    gulp.src('./gulp-fn.js')
      .pipe(gulpFn(function(file, enc) {
          console.log("Hello " + file.path);
      })
    );
});

API

gulpFn(fn, filter = true) : Transform
  • fn, function(file, enc) => void - required - callback function invoked for each file in the stream.
  • filter, boolean - default: true - if true pushes the file in the pipeline automatically (it is not possible to remove or add file to the stream).

NOTE: to add a file to the next step of the pipeline, you need to set the filter argument to false and use this (i.e., this.push(file) will add the file - done for every file by default or if filter is set to true).

Package Sidebar

Install

npm i gulp-fn

Weekly Downloads

1,397

Version

0.0.3

License

ISC

Unpacked Size

6.12 kB

Total Files

9

Last publish

Collaborators

  • thierry.spetebroot