Skip to content
Middleware to compile browserify files on request for development purpose.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
LICENSE.md
README.md
index.js
package.json
perftest.js

README.md

browserify-dev-middleware

Middleware to compile browserify files on request for development purpose.

Example

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.

Adding transforms

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');
  }
}));

Contributing

Please fork the project and submit a pull request with tests. Install node modules npm install and run tests with npm test.

License

MIT

Something went wrong with that request. Please try again.