Using the browserify require method, you can pass in a stream and an expose parameter to add a module to the bundle.
So, for example templatizer could pass its content directly to browserify instead of writing to a file and then reading from that file. Especially in cases where you don't check in any generated files, I think this can be cleaner.
The API could look like this and then under the hood it could convert the string to stream and expose it as templates.
beforeBuildJS: function (cb) {
cb(null, {
templates: {
content: templatizer('./client-templates'),
// Other browserify require options
}
});
}
This could be extended to beforeBuildCSS by just appending/prepending to the CSS.
I tried this at one point but it was blocked by a browserify bug, but I now forget which one. Either way, I'm gonna close this at it seems too complex now and likely won't happen.
Using the browserify
require
method, you can pass in a stream and anexpose
parameter to add a module to the bundle.So, for example
templatizer
could pass its content directly to browserify instead of writing to a file and then reading from that file. Especially in cases where you don't check in any generated files, I think this can be cleaner.The API could look like this and then under the hood it could convert the string to stream and expose it as
templates
.This could be extended to beforeBuildCSS by just appending/prepending to the CSS.