Middleware to compile browserify files on request for development purpose.
Say you have a folder /assets that has a /assets/commit.js file using browserify.
app.use(require('browserify-dev-middleware')({
src: __dirname + '/assets'
}));
In your view (using jade)
html
head
body
script( src='/commits.js' )
Browserify Dev Middleware will compile /assets/commits.js and serve it on request.
Add transforms by passing it as an option.
app.use(require('browserify-dev-middleware')({
src: '...',
transforms: [require('jadeify')]
}));
Specify global transforms too.
app.use(require('browserify-dev-middleware')({
src: '...',
globalTransforms: [require('deamdify')]
}));
Or pass any browserify options in
app.use(require('browserify-dev-middleware')({
src: '...',
noParse: [
require.resolve('./test/assets/jquery'),
require.resolve('./test/assets/ember')
],
insertGlobals: true
}));
Or intercept the bundle and act on it programatically
app.use(require('browserify-dev-middleware')({
src: '...',
intercept: function(b) {
b.add('./browser/main.js');
}
}));
Please fork the project and submit a pull request with tests. Install node modules npm install
and run tests with npm test
.
MIT