The javascripts directory is (you guessed it!) for storing all your javascript files.


Following a similar pattern with stylesheets, you should include a manifest file at javascripts/application.js.

As you can see at the bottom of your default layout (templates/layout.html.erb), it expects a javascript file as mentioned above.

<%= javascript_include_tag 'viewer/[site_slug]/application' %>

You can read more here if you are unfamiliar with loading files into the asset pipeline.


There are about a million javascript frameworks out there. We are partial to Backbone.js and use this gem to bring it into rails.

To use Backbone, all you need to add to application.js are these two lines:

//= require underscore
//= require backbone

We'll leave it up to you to set up your Backbone directory structure, but you can mimic the builder's structure if you'd like.

Like CSS frameworks, I'm not opposed to any others, but just haven't made them a priority because that's not what I use on a regular basis. Feel free to add others to Sapwood and create a pull request explaining why they are beneficial.

If you create a pull request to add a js framework, we're likely going to ask you to document how to use the library with Sapwood.

Other Helpers

You can keep an eye on our Gemfile to know what other helpers are already in the repo.

And, again, feel free to add your own to Sapwood if you think users will find global benefit to it.