Git Product home page Git Product logo

browserify-dev-middleware's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.