Permalink
Browse files

Added an example that writes the package to a file

  • Loading branch information...
1 parent 599c03c commit 669074bf3858bc727cecf3ddc2478ae94424bae2 @ryanflorence ryanflorence committed with Mar 25, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.md
View
@@ -18,3 +18,19 @@ Bundle code in lib/ and vendor/ and serve it with [Express](http://expressjs.com
var app = express.createServer();
app.get('/application.js', package.createServer());
app.listen(3000);
+
+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');
+ })
+ })

0 comments on commit 669074b

Please sign in to comment.