Brunch with Spine and Sass - The Hem way
Thanks to Brunch, this Skeleton will build one JS file to be included in your HTML, wrapping
CommonJS modules in the correct order. This way you can use
require() in your Coffee/JS/HTML files just like we used to do in Hem.
Additionally, it will compile your SASS file(s) into one compressed CSS file.
Clone the repository and run:
npm installwhich will install the required plugins. You need to have Node installed first
brunch buildwhich will build the following files:
public/application.jswrapping all the Coffee/JS files saved recursively in the
app/directory into CommonJS modules
- Brunch provides a
brunch watch --servercommand as well wich will serve your app and rebuild everything whenever a file is saved.
--app/ -controllers/ -models/ -views/ -styles/ -style.sass -lib/ (if you need to include additional JS libraries) -index.coffee (your main application file) --public/ -index.html -application.js (generated) -css/ -style.css (generated) --config.coffee --package.json
All modules are relative to the
app/ directory. Examples:
# to require spine.js Spine = require('lib/spine') # which is located in app/lib/spine.js # if you have a user.coffee file in the app/models and # you need to require it somewhere else: User = require('models/user') # which is located in app/models/user.coffee
Make sure to add:
module.exports = [your_module_identifier]
before the end of every file. Check Spine's documentation for more about CommonJS.
- Add testing support
- Add other CSS preprocessors support
- Add Handlebars Support (probabily will be the first update)
- SpineJS 1.2.2
- jQueryify 2.0.3 (jQuery npm module for the browser)
- Reach out for help or questions