Package Exports
- base-pipeline
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base-pipeline) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
base-pipeline 
base-methods plugin that adds pipeline and plugin methods for dynamically composing streaming plugin pipelines.
Install
Install with npm
$ npm i base-pipeline --saveUsage
var base = require('base-methods');
var pipeline = require('base-pipeline');
var bfs = require('base-fs');
// create your application and add the plugin
var app = base()
.use(pipeline())
.use(bfs)
// plugins may return a function
app.plugin('a', function() {
return through.obj(function(file, enc, next) {
next(null, file);
});
});
// or a stream
app.plugin('b', through.obj(function(file, enc, next) {
next(null, file);
});
// use registered plugins
app.src(['foo/*.hbs'])
.pipe(app.pipeline(['a', 'b']))
.pipe(app.dest('site/'))Supported signatures
Array of registered plugin names:
// register plugins
app.plugin('a', function() {});
app.plugin('b', function() {});
// pipeline
app.src(['foo/*.hbs'])
.pipe(app.pipeline(['a', 'b']))
.pipe(app.dest('site/'))List of registed plugin names:
// register plugins
app.plugin('a', function() {});
app.plugin('b', function() {});
// pipeline
app.src(['foo/*.hbs'])
.pipe(app.pipeline('a', 'b'))
.pipe(app.dest('site/'))Stacked:
// register plugins
app.plugin('a', function() {});
app.plugin('b', function() {});
app.plugin('c', function() {});
// pipeline
app.src(['foo/*.hbs'])
.pipe(app.pipeline('a'))
.pipe(app.pipeline('b'))
.pipe(app.pipeline('c'))
.pipe(app.dest('site/'))Functions that return a stream:
app.src(['foo/*.hbs'])
.pipe(app.pipeline(function() {
return through.obj(function(file, enc, next) {
next(null, file);
})
}))
.pipe(app.pipeline(function() {
return through.obj(function(file, enc, next) {
next(null, file);
})
}))
.pipe(app.dest('site/'))Streams:
app.src(['foo/*.hbs'])
.pipe(app.pipeline(through.obj(function(file, enc, next) {
next(null, file);
}))
.pipe(app.pipeline(through.obj(function(file, enc, next) {
next(null, file);
}))
.pipe(app.dest('site/'))Heads up!
In general, it's a best practice for plugins to return a function that returns a stream. This ensures that every time the function is called a new stream is returned.
API
Register a plugin by name
Params
name{String}fn{Function}
Create a plugin pipeline from an array of plugins.
Params
plugins{Array}: Each plugin is a function that returns a stream, or the name of a registered plugin.options{Object}returns{Stream}
Related projects
- base-cli: Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… more | homepage
- base-config: base-methods plugin that adds a
configmethod for mapping declarative configuration values to other 'base'… more | homepage - base-data: adds a
datamethod to base-methods. | homepage - base-methods: Starter for creating a node.js application with a handful of common methods, like
set,get,… more | homepage - base-options: Adds a few options methods to base-methods, like
option,enableanddisable. See the readme… more | homepage - base-plugins: Upgrade's plugin support in base-methods to allow plugins to be called any time after init. | homepage
- base-store: Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object… more | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm testContributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on November 06, 2015.