This prompted me to change to the asset pipeline, which in itself proved to be a bit like yak shaving, fixing one thing only to have a new bug appear.
One of my primary resources for enabling the asset pipeline was Ryan Bats excellent rails cast about upgrading to 3.1. It helps you get a basic asset pipeline setup.
The standard asset pipeline configuration in rails only covers
application.css, and I needed to add a couple of extra files.
One way to do this is to add them to the
['main.css', 'editor.js', "indgang.js"].each do |asset| config.assets.precompile << asset end
The problem is that in development mode the asset pipeline is turned off, and Rails serves the assets directly. This means you will not discover the error until deploying to production, where Rails throws a nasty “asset not pre-compiled” exception.
Images and Sass
Another small problem I faced was that images included from Sass was not showing up.
This was fixed by moving the images to
app/assets/images and using the
image-url Sass helper.
It will refer to the correct image path for images placed in