##Work in progress... Not everything is working as it should yet.
- Automatic rebuilding of site when files change
- Refreshes browser when files change
- On the fly transpiling of source files by the server, which are then cached by bb-server, so write your code in coffeescript for example, add it to your page and stop worrying about it.
- All static resources are cached by bb-server, in memory and on disk. If any original file changes only that file gets retranspiled, reminified and/or gzipped.
- Organise code in nodejs modules for use in the browser (without browserify)
- Automatic production mode when environment variable is set
- Stamping of files for caching purposes. So send out static resources with an infinite expire time.
- Minify and gzip all resources
- Write your html in snippets, then compose these to make bigger snippets, and then a full page.
- Server can serve single page application
- Server can serve phantomjs prerendered pages if a request for an escaped fragment comes in
- Server is basically a static file server, write your own request handlers for any non-static resource request, separated out by method (GET, POST etc). With a bit of hacking you could implement route handling, just call require fileHandler and pass on the request if there's no applicable route
For info on how configure html-builder see builder/recipe.js.
For info on how configure bb-server see server/server.js.
Clone or copy repo.
mv ./js-project ./your-new-project-name cd ./your-new-project-name
Make sure node, npm and bower are installed.
eg: node install -g bower
Edit .project/package.js and .project/bower.js and enter required packages under dependencies.
Edit build/recipe.js to set asset requests and their paths.
Edit server/server.js to configure the node server.
Set bin/URL to the address:port the app gets served from.
Run them in separate terminals and monitor both. See configuration for both bb-server and html-builder on how to enable a socket connection between these two and the browser for auto refresh on any changes to the hmlt/js/css.
If you're working on the bb-server and/or the html-builder use:
bin/serve-nodemon #or bin/build-nodemon
This will restart the relevant node process when the code changes.
bin/clearCache #clears bb-server's cache
Use rsync (edit it first) to deploy to a server
After a rsync, execute clearCache and build on the server to effect changes to the site.
I might change this to a git-deploy at one point with post receive hooks to update and rebuild the site, but for now:
On deployment server run:
to update package.json and bower.json respectively. Version numbers get bumped.
Make sure to start scripts in ./bin from the site's directory.