Getting started with any new framework or library can be daunting, but I’m going to do my best to ensure your first introduction to Spine is as straightforward as possible.
There are three main ways of using Spine:
bower install spine
This guide will cover the last approach, using Spine & Hem. However as mentioned previously, if you’re not into CoffeeScript, or you’re using Rails, you may want to look at the other two approaches.
If you haven’t got them installed already, you’ll need Node and npm. Both projects’ sites include excellent installation instructions. Now we can get on with installing the two npm modules we need,
npm install -g spine.app hem
Now we’ve got an executable called
spine which we can use to generate new applications.
spine app my-app cd my-app
Check out the article on Spine.app for more information concerning its usage. Now let’s install the default dependencies listed in our application’s
npm install .
Finally we can use the
hem executable to run a Hem server, which will temporarily host our Spine application during development.
Have an explore around the files Spine.app has generated. If you open up http://localhost:9294 you’ll just see a blank page. Let’s change our default controller so that it actually does something.
Let’s add a
@log() statement, as demonstrated below:
class App extends Spine.Controller constructor: -> super @log("Initialized") module.exports = App
Awesome. Now if you reload the application, you should see that log statement in the console.