UNPKG

6.36 kBMarkdownView Raw
1<h1 align="center">bankai</h1>
2
3<div align="center">
4 <strong>Streaming {js,html,css} compiler</strong>
5</div>
6
7---
8
9<div align="center">
10 <!-- Stability -->
11 <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
12 <img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square"
13 alt="API stability" />
14 </a>
15 <!-- NPM version -->
16 <a href="https://npmjs.org/package/bankai">
17 <img src="https://img.shields.io/npm/v/bankai.svg?style=flat-square"
18 alt="NPM version" />
19 </a>
20 <!-- Build Status -->
21 <a href="https://travis-ci.org/yoshuawuyts/bankai">
22 <img src="https://img.shields.io/travis/yoshuawuyts/bankai/master.svg?style=flat-square"
23 alt="Build Status" />
24 </a>
25 <!-- Test Coverage -->
26 <a href="https://codecov.io/github/yoshuawuyts/bankai">
27 <img src="https://img.shields.io/codecov/c/github/yoshuawuyts/bankai/master.svg?style=flat-square"
28 alt="Test Coverage" />
29 </a>
30 <!-- Downloads -->
31 <a href="https://npmjs.org/package/bankai">
32 <img src="https://img.shields.io/npm/dm/bankai.svg?style=flat-square"
33 alt="Downloads" />
34 </a>
35 <!-- Standard -->
36 <a href="https://codecov.io/github/yoshuawuyts/bankai">
37 <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square"
38 alt="Standard" />
39 </a>
40</div>
41
42## Philosophy
43Building things takes time. Configuring tooling takes time. We believe that by
44taking modular tools, and wrapping them in a zero-configuration package we
45can help people iterate faster and produce better results. And once people are
46deep enough into a project that they might need something different, we make
47sure they can easily create their own tooling from the components we use.
48
49## Usage
50```txt
51 Usage:
52 $ bankai <command> [options]
53
54 Commands:
55 <default> Run 'bankai start'
56 start <filename> Start a bankai server
57 build <filename> <directory> Compile and export files to a directory
58 inspect <filename> Visualize the dependency tree
59
60 Options:
61 -a, --assets=<directory> Serve static assets [default: assets]
62 -A, --address=<ip> Ip address to listen [default: localhost]
63 -c, --css=<subargs> Pass subarguments to sheetify
64 -d, --debug Include sourcemaps [default: false]
65 -e, --electron Enable electron mode for the bundler
66 -h, --help Print usage
67 -H, --html=<subargs> Pass subarguments to create-html
68 -j, --js=<subargs> Pass subarguments to browserify
69 -o, --open=<browser> Open html in a browser [default: system default]
70 -p, --port=<n> Bind bankai to a port [default: 8080]
71 -V, --verbose Include debug messages
72 -w, --watch <bool> Toggle watch mode
73 -u, --uglify <bool> Toggle uglifyify. [default: true]
74
75 Examples:
76 $ bankai index.js -p 8080 # start bankai on port 8080
77 $ bankai index.js --open # open html in the browser
78 $ bankai -c [ -u sheetify-cssnext ] # use cssnext in sheetify
79 $ bankai -j [ -t brfs ] # use brfs in browserify
80 $ bankai build index.js dist/ # compile and export to dist/
81
82 Notes:
83 When specifying both --watch and --uglify using the long form, you must omit
84 the = when specifying them to be turned off.
85
86 Examples:
87 bankai example.js --open=firefox-aurora -p 3000
88 bankai example.js --uglify false -w false
89```
90
91## API
92### assets = bankai(entryFile, [opts])
93Create a new instance of `bankai`. The first argument is a route to the entry
94file that is compiled by `browserify`. The second argument is optional and can
95take the following options:
96- __opts.js:__ (default: `{}`). Pass options to `browserify`. Cannot be
97 disabled
98- __opts.css:__ (default: `{}`). Pass options to `sheetify`. Set to `false` to
99 disable
100- __opts.html:__ (default: `{}`). Pass options to `create-html`. Set to `false`
101 to disable
102- __opts.watch:__ Disable livereload scripts
103- __opts.electron:__ (default `false`). Enable [electron][electron] mode for
104 the bundler. Relies on `index.html` being served as a static file using
105 `file://` to ensure `require()` paths are resolved correctly
106
107### readableStream = assets.js([req], [res])
108Return a `js` stream. Sets correct header values if `req` and `res` are passed.
109Uses [browserify][browserify] and [watchify][watchify] under the hood.
110
111### readableStream = assets.html([req], [res])
112Return a `html` stream. Sets correct header values if `req` and `res` are
113passed. Uses [create-html][chtml] under the hood.
114
115### readableStream = assets.css([req], [res])
116Return a `css` stream. Sets correct header values if `req` and `res` are
117passed. Uses [sheetify][sheetify] under the hood.
118
119## Installation
120```sh
121$ npm install bankai
122```
123
124## Uglify toggle
125Uglify only supports JavaScript syntax up to ES5. If you want to use later
126syntax you'll need to either disable the uglifyify transform with
127`--uglify=false` or add a compiler to convert your ES5+ syntax down to ES5.
128
129## See Also
130- [stackcss/sheetify][sheetify]
131- [substack/browserify][browserify]
132- [sethvincent/create-html][chtml]
133
134## Similar Packages
135- [mattdesl/budo](https://www.npmjs.com/package/budo)
136- [maxogden/wzrd](https://www.npmjs.com/package/wzrd)
137- [chrisdickinson/beefy](https://www.npmjs.com/package/beefy)
138
139## License
140[MIT](https://tldrlegal.com/license/mit-license)
141
142[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
143[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
144[2]: https://img.shields.io/npm/v/bankai.svg?style=flat-square
145[3]: https://npmjs.org/package/bankai
146[4]: https://img.shields.io/travis/yoshuawuyts/bankai/master.svg?style=flat-square
147[5]: https://travis-ci.org/yoshuawuyts/bankai
148[8]: http://img.shields.io/npm/dm/bankai.svg?style=flat-square
149[9]: https://npmjs.org/package/bankai
150[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
151[11]: https://github.com/feross/standard
152[electron]: https://github.com/electron/electron
153[sheetify]: https://github.com/stackcss/sheetify
154[watchify]: https://github.com/substack/watchify
155[browserify]: https://github.com/substack/node-browserify
156[chtml]: https://github.com/sethvincent/create-html