Middleware for Connect to allow resource transformation via streams.
This middleware was written to support development with gulp.js, and is not at all (not even a little bit) intended to be used standalone or in any kind of production capacity. So don't do that.
Instead, do this:
var gulp = ;var connect = ;var pipeline = ;var less = ;gulp;
npm i connect-resource-pipeline --save
An object which may contain:
Will be used to prefix all non-absolute paths in
files, or the URL path if
files is empty.
An array that defines URLs to be matched and what to return as a response. Each entry is an object comprised of:
The URL to match. Matched against
Enables caching of pipeline output. Set to
true to enable with the URL used as the cache key, or any
string used as the cache key.
File paths to match. Uses
vinyl-fs under the hood, so globs are allowed. If omitted, the
pathname of the
request will be used.
function(stream.Readable, Request): stream.Readable
A function that takes a stream of files as an argument and returns the result stream. The request object is passed as the second argument.
An array of factories that produce processors (gulp plugins). The matched
files will be
piped through each factory's plugin, in order, before being concatenated and sent as a response.
This functionality has been deprecated in favor of the far more flexible and gulp-like
Clear the contents of
cacheKey in the internal cache.
If you want to cache output and retain the ability to clear the cache (for example within a watch), save a reference to
the middleware instance you pass to
var gulp = ;var connect = ;var pipeline = ;gulp;
This has been tested with Connect 2.x and 3.x.
Sometimes doing neat things with your build makes running a local development server harder. Wouldn't it be nice if you could use the same plugins your build uses as part of a dynamic dev server? Yes, it would.