Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bankai: require instance before run #50

Merged
merged 1 commit into from
Aug 10, 2016
Merged

bankai: require instance before run #50

merged 1 commit into from
Aug 10, 2016

Conversation

yoshuawuyts
Copy link
Member

Changes the API to require initialization before usage. Paves the way for cleaner internals. New option: opts.optimize; optimization toggle flag, rather than relying on env vars ✨

const browserify = require('browserify')
const bankai = require('bankai')
const http = require('http')
const path = require('path')

const client = path.join(__dirname, 'client.js')

const assets = bankai()
const js = assets.js(browserify, client)
const html = assets.html()
const css = assets.css()

http.createServer((req, res) => {
  switch req.url {
    case '/': return html(req, res).pipe(res)
    case '/bundle.js': return js(req, res).pipe(res)
    case '/bundle.css': return css(req, res).pipe(res)
    default: return res.statusCode = 404 && res.end('404 not found')
  }
}).listen(8080)

Thanks! ✨

cc/ @marionebl

@marionebl marionebl mentioned this pull request Aug 9, 2016
@yoshuawuyts yoshuawuyts merged commit ec28266 into master Aug 10, 2016
@yoshuawuyts yoshuawuyts deleted the instanceify branch August 10, 2016 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant