We want people to have fun building things for the web. There should be no hurdles between a great idea, and your first prototype. And once you're ready, it should be easy to package it up and share it online. That's Bankai: a tool that helps you build for the web. No configuration, and no hassle - that's our promise.
If this is your first time building something for the web, take a look at choojs/create-choo-app to help get a project setup from scratch ✨.
$ bankai <command> [entry] [options]Commands:build compile all files to dist/inspect inspect the bundle dependenciesstart start a development serverOptions:-d, --debug output lots of logs-h, --help print usage-q, --quiet don't output any logs-v, --version print versionExamples:Start a development server$ bankai start index.jsVisualize all dependencies in your project$ bankai inspect index.jsCompile all files in the project to disk$ bankai build index.jsRunning into trouble? Feel free to file an issue:Do you enjoy using this software? Become a backer:
When you first open up your application in a browser, you'll probably see a warning page about HTTPS connections being untrusted. No worries, this is entirely expected behavior. Follow the instructions below to solve this for your browser.
localhost, we must sign a TLS certificate locally. This is better known as a "self-signed certificate". Browsers actively check for certificates from uknown providers, and warn you (for good reason!) In our case, however, it's safe to ignore.
HTTPS is needed for an increasing amount of APIs to work in the browser. For example if you want to test HTTP/2 connections or use parts of the storage API, you have no choice but to use an HTTPS connection on localhost. That's why we try and make this work as efficiently, and securely as possible.
We generate a unique certificate for each Bankai installation. This means that you'll only need to trust an HTTPS certificate for Bankai once. This should be secure from remote attackers, because unless they have successfully acquired access to your machine's filesystem, they won't be able to replicate the certificate.
A wild security screen appears!. Click on "advanced".
More details emerge! Click on "Add Exception".
In the dropdown click "Confirm Security Exception".
More details emerge! Check "Always trust 'localhost'…".
The box is checked! Click "Continue".
A box is asking you for your crendentials. Fill them in, and hit "Enter".
Bankai applies lots of optimizations to projects. Generally you won't need to care how we do this: it's lots of glue code, and not necessarily pretty. But it can be useful to know which optimizations we apply. This is a list:
require('assert')statements from the code. Only applied for production builds.
chooHTML code so it run significantly faster in the browser.
fs.readFile(). Useful to ship assets in the browser.
<head>of the document. This means that every page will be able to render after the first roundtrip, which makes for super snappy pages.
manifest.jsonso the application can be installed on mobile.
manifest.jsonso the navigator bar on mobile is styled on brand.
The Bankai CLI doesn't take any flags, other than to manipulate how we log to
the console. Configuring Bankai is done by modifying
Bankai is built on three technologies:
documentify. Because these can be
package.json it means that Bankai itself can be configured
from there too. Also if people ever decide to switch from the command line to
Bankai can be hooked up directly to an HTTP server, which is useful when working on full stack code.
var bankai =var http =var path =var compiler =var server = httpserver
Not all browsers support all of the Web Platform's features. So in order to use newer features on older browsers, we have to find a solution. The best solution out there at the moment is Babel.
target. In Bankai we target the last 2 versions of FireFox, Chrome and Edge,
and every other browser that's used by more than 1% of people on earth. This
includes IE11. And if you have different opinions on which browsers to use,
being the clearest example. To enable this features, the
library needs to be included in your application's root (e.g.
We don't include this file by default in Bankai, because it has a significant
size overhead. Once Babel includes only the language features you're using,
we'll work to include
babel-polyfill by default.
Whenever an internal error occurs.
compiler.on('change', callback(nodeName, edgeName, state))
Whenever a change in the internal graph occurs.
compiler = bankai(entry, [opts])
Create a new bankai instance. Takes either an entry file location, or an array of files.
compiler.documents(routename, [opts], done(err, buffer))
Output an HTML bundle for a route. Routes are determined based on the project's
'/' to get the default route.
<head>of the body as
compiler.scripts(filename, done(err, buffer))
Pass in a filename and output a JS bundle.
compiler.assets(assetName, done(err, buffer))
Output any other file besides JS, CSS or HTML.
compiler.styles(name, done(err, buffer))
Output a CSS bundle.
Output a service worker.
Close all file watchers.
Apache License 2.0