Quick 'n' Dirty
- Painless CoffeeScript development inside of the familiar Sinatra platform.
- Compile CoffeeScript automatically on browser refresh in development mode
- Emulates Rails 3.1's asset pipeline
git clone firstname.lastname@example.org:hjhart/exploring_backbone.git cd exploring_backbone cp .rvmrc.example .rvmrc
(optional) Open up your new .rvmrc file and change the gemset to the name of your project name (or whatever else you want it to be) Change the environment variable if you don't want to work with ruby-1.9.2.
When prompted to trust the file, say yes. This will create the gemset and run bundler. This actually takes a while for therubyracer to install.
Where do my coffeescript files go?
All of your coffeescript files will go into the
When you want to link to them from a view, link to
public/assets. You can link to the static files the same way.
Place a coffescript file named
utils.coffee inside of the
backbone.js inside of your
Linking to them is consistent and is very simple:
In development mode,
/assets/utils.js will compile the coffeescript on every refresh.
public/assets (see notes below)
Start up the server in development
Start up the server in production
Production is as simple as running
rackup -E production.
public/assets/ folder where they'll be fed as static resources.
Message me on twitter @hjhart, or, submit issues on github.