Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bankai

Package Overview
Dependencies
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bankai

DIY asset server

  • 2.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
109
decreased by-44.95%
Maintainers
3
Weekly downloads
 
Created
Source

bankai stability

npm version build status test coverage downloads js-standard-style

DIY asset server. Serves HTML, CSS and JS as streams. Sets proper Content-Type encodings and buffers where possible for sub-milisecond response times in production and development.

Installation

$ npm install bankai

Usage

const serverRouter = require('server-router')
const browserify = require('browserify')
const bankai = require('bankai')
const http = require('http')

const router = createRouter()
http.createServer(function (req, res) {
  router(req, res).pipe(res)
}).listen(1337)

function createRouter () {
  const router = serverRouter()

  const html = bankai.html()
  router.on('/', html)

  const css = bankai.css({ use: [ 'sheetify-cssnext' ] })
  router.on('/bundle.css', css)

  const js = bankai.js(browserify, '/src/index.js', { transform: 'babelify' })
  router.on('/bundle.js', js)

  return router
}

API

bankai.html(opts)

Return an html stream. Cached by default. Includes livereload if NODE_ENV=development. Takes the following options:

  • opts.entry: js entry point. Defaults to /bundle.js
  • opts.css: css entry point. Defaults to /bundle.css

bankai.css(opts)

Return a css stream. Cached if NODE_ENV=production. Takes the following options:

  • use: array of transforms. Empty by default.
  • basedir: project base directory. Defaults to process.cwd()

bankai.js(browserify, src, opts)

Return a js stream. Uses watchify for incremental builds if NODE_ENV=development. src is the bundle entry file. Cached by default.

See Also

License

MIT

Keywords

FAQs

Package last updated on 29 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc