bankai
Advanced tools
Comparing version 5.5.0 to 5.5.1
41
bin.js
@@ -25,3 +25,3 @@ #!/usr/bin/env node | ||
string: [ 'open', 'port', 'assets' ], | ||
boolean: [ 'optimize', 'verbose', 'help', 'version', 'debug' ], | ||
boolean: [ 'optimize', 'verbose', 'help', 'version', 'debug', 'electron' ], | ||
default: { | ||
@@ -38,2 +38,3 @@ assets: 'assets', | ||
debug: 'd', | ||
electron: 'e', | ||
help: 'h', | ||
@@ -61,11 +62,12 @@ html: 'H', | ||
-a, --assets=<directory> Serve static assets [default: assets] | ||
-c, --css=<subargs> Pass subarguments to sheetify | ||
-d, --debug Include sourcemaps [default: false] | ||
-h, --help Print usage | ||
-H, --html=<subargs> Pass subarguments to create-html | ||
-j, --js=<subargs> Pass subarguments to browserify | ||
-o, --open=<browser> Open html in a browser [default: system default] | ||
-O, --optimize Optimize assets served by bankai [default: false] | ||
-p, --port=<n> Bind bankai to a port [default: 8080] | ||
-V, --verbose Include debug messages | ||
-c, --css=<subargs> Pass subarguments to sheetify | ||
-d, --debug Include sourcemaps [default: false] | ||
-e, --electron Enable electron mode for the bundler | ||
-h, --help Print usage | ||
-H, --html=<subargs> Pass subarguments to create-html | ||
-j, --js=<subargs> Pass subarguments to browserify | ||
-o, --open=<browser> Open html in a browser [default: system default] | ||
-O, --optimize Optimize assets served by bankai [default: false] | ||
-p, --port=<n> Bind bankai to a port [default: 8080] | ||
-V, --verbose Include debug messages | ||
@@ -87,2 +89,11 @@ Examples: | ||
} | ||
if (argv.h) { | ||
console.log(usage) | ||
return process.exit() | ||
} else if (argv.v) { | ||
console.log(require('../package.json').version) | ||
return process.exit() | ||
} | ||
var cmd = argv._[0] | ||
@@ -94,12 +105,2 @@ var _entry = argv._[1] || 'index.js' | ||
if (argv.h) { | ||
log.info(usage) | ||
return process.exit() | ||
} | ||
if (argv.v) { | ||
log.info(require('../package.json').version) | ||
return process.exit() | ||
} | ||
if (cmd === 'start') { | ||
@@ -106,0 +107,0 @@ start(entry, argv, handleError) |
@@ -19,2 +19,4 @@ var collapser = require('bundle-collapser/plugin') | ||
var createElectronOpts = require('./electron') | ||
module.exports = Bankai | ||
@@ -60,8 +62,11 @@ | ||
var base = { | ||
basedir: process.cwd(), | ||
entries: [ entry ], | ||
packageCache: {}, | ||
fullPaths: true, | ||
cache: {} | ||
} | ||
base = (opts.electron) | ||
? xtend(base, createElectronOpts()) | ||
: xtend(base, { fullPaths: true }) | ||
var jsOpts = xtend(base, opts.js) | ||
@@ -68,0 +73,0 @@ |
{ | ||
"name": "bankai", | ||
"version": "5.5.0", | ||
"version": "5.5.1", | ||
"description": "DIY asset server", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
113
README.md
@@ -7,3 +7,3 @@ <h1 align="center">bankai</h1> | ||
<div align="center"> | ||
Serve, compile and optimize assets | ||
Bundle and optimize CSS, HTML and JS | ||
</div> | ||
@@ -46,8 +46,42 @@ | ||
## Installation | ||
```sh | ||
$ npm install bankai | ||
## Features | ||
- Thin wrapper around `browserify` in ~100 lines | ||
- CLI supports HTTP and Filesystem | ||
- Incremental compilation & build caching | ||
- Sensible defaults make it easy to use | ||
- Optimization mode for production grade artifacts | ||
## Usage | ||
```txt | ||
Usage: | ||
$ bankai <command> [options] | ||
Commands: | ||
<default> Run 'bankai start' | ||
start <filename> Start a bankai server | ||
build <filename> <directory> Compile and export files to a directory | ||
Options: | ||
-c, --css=<subargs> Pass subarguments to sheetify | ||
-d, --debug Include sourcemaps [default: false] | ||
-e, --electron Enable electron mode for the bundler | ||
-h, --help Print usage | ||
-H, --html=<subargs> Pass subarguments to create-html | ||
-j, --js=<subargs> Pass subarguments to browserify | ||
-o, --open=<browser> Open html in a browser [default: system default] | ||
-O, --optimize Optimize assets served by bankai [default: false] | ||
-p, --port=<n> Bind bankai to a port [default: 8080] | ||
-V, --verbose Include debug messages | ||
Examples: | ||
$ bankai index.js -p 8080 # start bankai on port 8080 | ||
$ bankai index.js --open # open html in the browser | ||
$ bankai -c [ -u sheetify-cssnext ] # use cssnext in sheetify | ||
$ bankai -j [ -t brfs ] # use brfs in browserify | ||
$ bankai build index.js dist/ # compile and export to dist/ | ||
$ bankai build -O index.js dist/ # optimize compiled files | ||
``` | ||
## Usage | ||
## JS Usage | ||
Given the following `client.js`: | ||
@@ -90,34 +124,4 @@ ```js | ||
## CLI | ||
```txt | ||
Usage: | ||
$ bankai <command> [options] | ||
Commands: | ||
<default> Run 'bankai start' | ||
start <filename> Start a bankai server | ||
build <filename> <directory> Compile and export files to a directory | ||
Options: | ||
-c, --css=<subargs> Pass subarguments to sheetify | ||
-d, --debug Include sourcemaps [default: false] | ||
-h, --help Print usage | ||
-H, --html=<subargs> Pass subarguments to create-html | ||
-j, --js=<subargs> Pass subarguments to browserify | ||
-o, --open=<browser> Open html in a browser [default: system default] | ||
-O, --optimize Optimize assets served by bankai [default: false] | ||
-p, --port=<n> Bind bankai to a port [default: 8080] | ||
-V, --verbose Include debug messages | ||
Examples: | ||
$ bankai index.js -p 8080 # start bankai on port 8080 | ||
$ bankai index.js --open # open html in the browser | ||
$ bankai -c [ -u sheetify-cssnext ] # use cssnext in sheetify | ||
$ bankai -j [ -t brfs ] # use brfs in browserify | ||
$ bankai build index.js dist/ # compile and export to dist/ | ||
$ bankai build -O index.js dist/ # optimize compiled files | ||
``` | ||
## API | ||
### assets = bankai(entryFile, opts?) | ||
### assets = bankai(entryFile, [opts]) | ||
Create a new instance of `bankai`. The first argument is a route to the entry | ||
@@ -135,17 +139,33 @@ file that is compiled by `browserify`. The second argument is optional and can | ||
- __opts.watch:__ Disable livereload scripts | ||
- __opts.electron:__ (default `false`). Enable [electron][electron] mode for | ||
the bundler. Relies on `index.html` being served as a static file using | ||
`file://` to ensure `require()` paths are resolved correctly | ||
### readableStream = assets.js(req?, res?) | ||
### readableStream = assets.js([req], [res]) | ||
Return a `js` stream. Sets correct header values if `req` and `res` are passed. | ||
Uses [browserify][browserify] and [watchify][watchify] under the hood. | ||
### readableStream = assets.html(req?, res?) | ||
Return a `html` stream. Sets correct header values if `req` and `res` are passed. | ||
### readableStream = assets.html([req], [res]) | ||
Return a `html` stream. Sets correct header values if `req` and `res` are | ||
passed. Uses [create-html][chtml] under the hood. | ||
### readableStream = assets.css(req?, res?) | ||
Return a `css` stream. Sets correct header values if `req` and `res` are passed. | ||
### readableStream = assets.css([req], [res]) | ||
Return a `css` stream. Sets correct header values if `req` and `res` are | ||
passed. Uses [sheetify][sheetify] under the hood. | ||
## Installation | ||
```sh | ||
$ npm install bankai | ||
``` | ||
## See Also | ||
- [budo](https://www.npmjs.com/package/budo) | ||
- [sheetify](https://github.com/sheetify/sheetify) | ||
- [browserify](https://github.com/substack/node-browserify) | ||
- [stackcss/sheetify][sheetify] | ||
- [substack/browserify][browserify] | ||
- [sethvincent/create-html][chtml] | ||
## Similar Packages | ||
- [mattdesl/budo](https://www.npmjs.com/package/budo) | ||
- [maxogden/wzrd](https://www.npmjs.com/package/wzrd) | ||
- [chrisdickinson/beefy](https://www.npmjs.com/package/beefy) | ||
## License | ||
@@ -164,1 +184,6 @@ [MIT](https://tldrlegal.com/license/mit-license) | ||
[11]: https://github.com/feross/standard | ||
[electron]: https://github.com/electron/electron | ||
[sheetify]: https://github.com/stackcss/sheetify | ||
[watchify]: https://github.com/substack/watchify | ||
[browserify]: https://github.com/substack/node-browserify | ||
[chtml]: https://github.com/sethvincent/create-html |
20394
9
341
185