
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
gulp-middleware
Advanced tools
Run middleware in a gulp pipeline/vinyl source stream.
Install with npm:
$ npm install gulp-middleware --save
See API docs.
Use as a gulp plugin:
var gulp = require('gulp');
var middleware = require('gulp-middleware');
gulp.task('middleware', function() {
return gulp.src('*.js')
// function or array of functions
.pipe(middleware(fns))
});
See API docs.
Use with vinyl-fs:
var fs = require('fs');
var File = require('vinyl');
var through = require('through2');
var middleware = require('gulp-middleware');
function toStream(path) {
return fs.createReadStream(path)
.pipe(through.obj(function(contents, enc, next) {
next(null, new File({path, contents}));
}))
}
toStream('README.md')
.pipe(middleware(fn))
.pipe(middleware([fn, fn, fn]))
function fn(file, next) {
console.log(file);
next();
}
Run middleware in series.
Params
fns {Array}: Array of middleware functionsExample
var middleware = require('gulp-middleware');
gulp.task('middleware', function() {
return gulp.src('*.js')
.pipe(middleware(fn('bar')))
.pipe(middleware([
fn('foo'),
fn('bar'),
fn('baz')
]))
});
function fn(name) {
return function(file, next) {
console.log(name);
next();
};
}
Run middleware in parallel.
Params
fns {Array}: Array of middleware functionsExample
var middleware = require('gulp-middleware');
gulp.task('middleware', function() {
return gulp.src('*.js')
.pipe(middleware(fn('bar')))
.pipe(middleware.parallel([
fn('foo'),
fn('bar'),
fn('baz')
]))
});
function fn(name) {
return function(file, next) {
console.log(name);
next();
};
}
You might also be interested in these projects:
This document was generated by verb, please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on May 27, 2016.
FAQs
Run middleware in a gulp pipeline/vinyl source stream.
We found that gulp-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.