Browserify (GitHub: substack /
node-browserify) by James
Halliday makes CommonJS packages work in browsers by bundling up modules
into a monolithic file. I know we've had a lot of script loaders on
DailyJS, and detailed discussions about monolithic files vs. loading
scripts on demand, but I assume James has structured Browserify this way
to make the
require syntax easy to support.
The package includes Connect middleware:
var connect = require('connect'); var server = connect.createServer(); server.use(connect.static(__dirname)); server.use(require('browserify')(__dirname + '/js')); server.listen(9797);
The dependency support is interesting as well:
If the npm modules have dependencies, those dependencies will get bundled along recursively!
It's also possible to run modules through minifiers, using post-filters.
I think this must be the most convenient way to share code between Node
and browsers that I've seen so far.
It can be set up with an Express app like this:
var app = express.createServer(); app.listen(3000); var everyone = require("now").initialize(app);
The authors have already written a NowJS Coding Patterns and Best
Practices guide, which explains how to
filter messages at the client-side (for creating rooms in a chat
application), and tips for keeping things efficient.
Vogue (GitHub: andrewdavey /
License) by Andrew Davey automatically reloads stylesheets whenever they're
saved. It uses Socket.IO so it feels pretty
responsive. It's a great idea for use during development, and I imagine
it would blow your design team's collective minds.