The stream interface right now is an array attribute called pipe.
I foresee an opportunity for improvements, giving the user more freedom in terms of handling the stream.
This may implicate an overall change of the current API.
This is a tentative solution:
var fs = require('fs');
var require_less_factory = require('require-less');
var less_opts = {...};
function css_stream_processor( css_stream ) {
// This function will be called when the less parser finishes
// it's work and returns the css stream
css_stream.pipe(stream_transform1)
.pipe(stream_transform2)
...
.pipe(stream_transformn)
.pipe(fs.createWriteStream('path/compiled.css'));
};
var require_less_transform = require_less_factory(
less_opts,
css_stream_processor
);
var browserify = require('browserify');
browserify_opts = {...}
browserify(browserify_opts).transform(require_less);
This illustrates that with this type of API the library is not just giving access to the pipeline, but its giving access to the css_stream itself, potentially providing more flexibility and composability, and also providing a more standard way of handling the stream.
The stream interface right now is an array attribute called
pipe
. I foresee an opportunity for improvements, giving the user more freedom in terms of handling the stream.This may implicate an overall change of the current API.
This is a tentative solution:
This illustrates that with this type of API the library is not just giving access to the pipeline, but its giving access to the css_stream itself, potentially providing more flexibility and composability, and also providing a more standard way of handling the stream.