Develop and test your JavaScript applications as CommonJS modules in Node.js. Then Stitch them together to run in the browser.
var stitch = require('stitch');
var express = require('express');
var package = stitch.createPackage({
paths: [__dirname + '/lib', __dirname + '/vendor']
});
var app = express.createServer();
app.get('/application.js', package.createServer());
app.listen(3000);
var stitch = require('stitch');
var fs = require('fs');
var package = stitch.createPackage({
paths: [__dirname + '/lib', __dirname + '/vendor']
});
package.compile(function (err, source){
fs.writeFile('package.js', source, function (err) {
if (err) throw err;
console.log('Compiled package.js');
})
})