Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Express middleware to export JS modules to the browser.

Write your client side javascript as node modules. Keep it with your server side code. Maintain one code base. Export your client side modules to the browser.

Should be compatible with all packages labelled 'browserify'.


// Do this after you've defined app as Express...
// it adds the object 'browserx' to app.locals, for use later on.
var browserx = require('browserx')({ applicationRoot : __dirname, locals : app.locals });

// add some middleware

// Then in your layout.jade, give browserx your entry point JS.
// Make sure it's a path relative to /app.js, not the template.
!= browserx.upload('./lib/client.js')

##What is generated

What is sent to the browser is a single file that contains your entry point script, an implemention of require(), a tiny bit of shimmery for node stuff, and any dependencies compiled as modules.


Hideously early. Works like Browserify, but without requiring a build step or unit tests. Or versions of Node builtins. Or, in fact, any sort of testing really.