This repository has been archived by the owner. It is now read-only.
Stitch your CommonJS modules together for the browser
CoffeeScript JavaScript
Clone or download
Latest commit a734ece Nov 2, 2012
Failed to load latest commit information.
src Circular require now also works with module.exports. Dec 29, 2011
.gitignore Ignore node_modules/ dir Mar 31, 2011
package.json Bump CoffeeScript dependency to 1.3.0 and rebuild Nov 1, 2012

Develop and test your JavaScript applications as CommonJS modules in Node.js. Then Stitch them together to run in the browser.

npm install stitch

Bundle code in lib/ and vendor/ and serve it with Express:

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());

Or build it to a file:

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');