Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 37 lines (26 sloc) 1.024 kB
59f5fa8 @sstephenson Logo
sstephenson authored
1 <img src="https://github.com/downloads/sstephenson/stitch/logo.jpg"
2 width=432 height=329>
ea9a37f @sstephenson Initial commit
sstephenson authored
3
4 Develop and test your JavaScript applications as CommonJS modules in
5 Node.js. Then __Stitch__ them together to run in the browser.
8d00487 @sstephenson Add an Express example
sstephenson authored
6
714a465 @sstephenson Stitch 0.1.0
sstephenson authored
7 npm install stitch
8
9 Bundle code in lib/ and vendor/ and serve it with [Express](http://expressjs.com/):
10
8d00487 @sstephenson Add an Express example
sstephenson authored
11 var stitch = require('stitch');
12 var express = require('express');
13
14 var package = stitch.createPackage({
15 paths: [__dirname + '/lib', __dirname + '/vendor']
16 });
17
18 var app = express.createServer();
19 app.get('/application.js', package.createServer());
58d11d9 @sstephenson Add an Express example
sstephenson authored
20 app.listen(3000);
669074b @ryanflorence Added an example that writes the package to a file
ryanflorence authored
21
22 Or build it to a file:
23
24 var stitch = require('stitch');
25 var fs = require('fs');
26
27 var package = stitch.createPackage({
28 paths: [__dirname + '/lib', __dirname + '/vendor']
29 });
30
31 package.compile(function (err, source){
32 fs.writeFile('package.js', source, function (err) {
33 if (err) throw err;
34 console.log('Compiled package.js');
35 })
36 })
Something went wrong with that request. Please try again.