require('modules') in the browser
Write your browser code with node.js-style requires:
var foo = require('./foo');
var gamma = require('gamma');

var n = gamma(foo(5) * 3);
var txt = document.createTextNode(n);
Export functionality by assigning onto module.exports or exports:
module.exports = function (n) { return n * 11 }
Install modules with npm:
npm install gamma
Now recursively bundle up all the required modules starting at main.js into a single file with the browserify command:
browserify main.js -o bundle.js
Browserify parses the AST for require() calls to traverse the entire dependency graph of your project.
Drop a single <script> tag into your html and you're done!
<script src="bundle.js"></script>



First install node, which ships with npm. Then do:
npm install -g browserify
clone these articles!
git clone $REMOTE
wizard hat