File tree Expand file tree Collapse file tree 6 files changed +41
-8
lines changed Expand file tree Collapse file tree 6 files changed +41
-8
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ Return a `css` stream using [sheetify](https://github.com/stackcss/sheetify).
5454### assets.js(browserify, src, opts?)
5555Return a ` js ` stream. ` src ` is the bundle entry file. ` opts ` are passed
5656directly to ` browserify `
57+ - __ opts.id__ id to expose the root bundle as via ` require() ` . Defaults to ` bankai-app `
58+ - __ opts.basedir__ directory to resolve ` src ` from. Defaults to ` process.cwd() `
59+ - __ opts.fullPaths__ use full module paths as module ids. Defaults to ` true `
5760
5861## CLI
5962
@@ -115,7 +118,7 @@ $ node ./bin/ --help
115118Projects showing exemplary usage are provided. Install root project dependencies,
116119example project dependencies and execute ` npm start ` to start an example.
117120
118- - [ Basic] ( ./example/basic ) - Showing default settings, Hot Module Replacement
121+ - [ Basic] ( ./example/basic ) - Minimal CLI and API usage
119122
120123## See Also
121124- [ budo] ( https://www.npmjs.com/package/budo )
Original file line number Diff line number Diff line change 1+ dist /
Original file line number Diff line number Diff line change 44 "description" : " Basic example of using bankai" ,
55 "main" : " index.js" ,
66 "scripts" : {
7- "start" : " ../../bin/index.js start --css.use sheetify-cssnext"
7+ "start" : " ../../bin/index.js start --css.use sheetify-cssnext" ,
8+ "build" : " ../../bin/index.js build --css.use sheetify-cssnext" ,
9+ "server" : " node server.js"
810 },
911 "license" : " MIT" ,
1012 "dependencies" : {
Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ of developers looking into bankai as development tool.
55
66## Features
77
8- * Easy cli usage of default bankai
8+ * Easy cli usage of default bankai server ` npm start `
9+ * Builds via ` npm run build `
10+ * Minimalistic bankai server implemented with node api ` npm run server `
911* Scoped styles via sheetify
1012
1113## Installation
@@ -17,5 +19,7 @@ npm install
1719## Usage
1820
1921``` shell
20- npm start
22+ npm start # start a default bankai server via "bankai start" cli
23+ npm run build # run default bankai build process via "bankai build" cli
24+ npm run server # run a minimal bankai server via bankai node api
2125```
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const serverRouter = require ( 'server-router' )
4+ const browserify = require ( 'browserify' )
5+ const bankai = require ( '../../' ) ( )
6+ const http = require ( 'http' )
7+
8+ const html = bankai . html ( )
9+ const css = bankai . css ( { use : [ 'sheetify-cssnext' ] } )
10+ const js = bankai . js ( browserify , './index.js' , { basedir : __dirname } )
11+
12+ const routes = [
13+ [ '/' , html ] ,
14+ [ '/404' , html ] ,
15+ [ '/bundle.css' , css ] ,
16+ [ 'bundle.js' , js ]
17+ ]
18+
19+ const router = serverRouter ( '/404' , routes )
20+ const server = http . createServer ( ( req , res ) => router ( req , res ) . pipe ( res ) )
21+
22+ server . listen ( 1337 , ( ) => {
23+ console . log ( 'Started bankai on http://localhost:1337' )
24+ } )
Original file line number Diff line number Diff line change @@ -29,19 +29,18 @@ function js (state) {
2929 opts : opts
3030 }
3131
32- const resolvedSrc = require . resolve ( src )
33-
3432 const baseBrowserifyOpts = {
3533 id : 'bankai-app' ,
34+ basedir : process . cwd ( ) ,
3635 cache : { } ,
3736 packageCache : { } ,
38- entries : [ resolvedSrc ] ,
37+ entries : [ src ] ,
3938 fullPaths : true
4039 }
4140 const browserifyOpts = xtend ( baseBrowserifyOpts , opts )
4241 var b = browserify ( browserifyOpts )
4342
44- b . require ( resolvedSrc , {
43+ b . require ( src , {
4544 expose : browserifyOpts . id
4645 } )
4746
You can’t perform that action at this time.
0 commit comments