0.4.5 • Published 11 years ago

sardines v0.4.5

Weekly downloads
110
License
-
Repository
-
Last release
11 years ago

What is it?

Combine all node.js scripts into one file. Run it as a single executable, or online.

Features

  • Combine all scripts into one (shrinkwrap method)
  • Asynchronously load all scripts (browserify method)
  • express middleware

JS Example

var sardines = require("sardines"),
fs = require("fs");

sardines.shrinkwrap({
	entry: __filename
}, function(err, content) {
	fs.writeFile(__dirname + "/shrinkwrapped.js", content);
});

Express example

var server = require("express").createServer();
server.use(require("sardines").middleware({
	directory: __dirname + "/public"
}));
server.listen(8080);

In your browser, load a script and append one of the following query arguments: shrinkwrap, browserify, or wrap.

Like so:

http://localhost:8080/js/app.js?browserify # asynchronously loads ALL scripts vs loading into one
http://localhost:8080/js/app.js?shrinkwrap # loads all scripts into one
http://localhost:8080/js/app.js?wrap # wraps the script in a function so it doesn't pollute the global namespace

Terminal Usage

Usage: sardines [include] -e [entry] -o [output] -p [port] -d -s

Options:
  -s, --server     run the http server             
  -d, --directory  public directory for http server  [default: cwd]
  -p, --port                                         [default: 8080]
  -m  --method                                       [default: "shrinkwrap"]

Terminal Examples

sardines -e app.js -o app.shrinkwrap.js -m shrinkwrap # shrinkwrap the app
sardines -s # start the server
0.4.5

11 years ago

0.4.4

11 years ago

0.4.3

11 years ago

0.4.2

11 years ago

0.4.1

11 years ago

0.4.0

11 years ago

0.3.5

11 years ago

0.3.4

11 years ago

0.3.3

12 years ago

0.3.2

12 years ago

0.3.1

12 years ago

0.3.0

12 years ago

0.2.5

12 years ago

0.2.4

12 years ago

0.2.3

12 years ago

0.2.1

12 years ago

0.2.0

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.8

12 years ago

0.0.7

13 years ago

0.0.6

13 years ago

0.0.5

13 years ago

0.0.4

13 years ago

0.0.2

13 years ago