Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including bankai with all npm packages installed. Try it out:

var bankai = require("bankai")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bankai v8.1.1

DIY asset server

bankai

Streaming {js,html,css} compiler

Philosophy

Building things takes time. Configuring tooling takes time. We believe that by taking modular tools, and wrapping them in a zero-configuration package we can help people iterate faster and produce better results. And once people are deep enough into a project that they might need something different, we make sure they can easily create their own tooling from the components we use.

Usage

  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
    inspect <filename>             Visualize the dependency tree

    Options:
      -a, --assets=<directory>  Serve static assets [default: assets]
      -A, --address=<ip>      Ip address to listen [default: localhost]
      -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]
      -p, --port=<n>          Bind bankai to a port [default: 8080]
      -V, --verbose           Include debug messages
      -w, --watch <bool>      Toggle watch mode

  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/

  Notes:
    When specifying --watch using the long form, you must omit
    the = when specifying them to be turned off.

  Examples:
    bankai example.js --open=firefox-aurora -p 3000
    bankai example.js --watch false

API

assets = bankai(entryFile, [opts])

Create a new instance of bankai. The first argument is a route to the entry file that is compiled by browserify. The second argument is optional and can take the following options:

  • opts.js: (default: {}). Pass options to browserify. Cannot be disabled
  • opts.css: (default: {}). Pass options to sheetify. Set to false to disable
  • opts.html: (default: {}). Pass options to create-html. Set to false to disable
  • opts.watch: Disable livereload scripts
  • opts.electron: (default false). Enable electron mode for the bundler. Relies on index.html being served as a static file using file:// to ensure require() paths are resolved correctly
  • opts.assert: (default: true) disable all calls to require('assert')

readableStream = assets.js([req], [res])

Return a js stream. Sets correct header values if req and res are passed. Uses browserify and watchify under the hood.

readableStream = assets.html([req], [res])

Return a html stream. Sets correct header values if req and res are passed. Uses create-html under the hood.

readableStream = assets.css([req], [res])

Return a css stream. Sets correct header values if req and res are passed. Uses sheetify under the hood.

readableStream = assets.static([req], [res])

Return a static stream. Don't set any header. Useful to serve static assets like images, icons, fonts, etc. Uses send under the hood.

Installation

$ npm install bankai

See Also

Similar Packages

License

MIT

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free