Assets & Precompilation

Rails 3's asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB.

Gem versions 2.4.1 and later include support for Rails 3's asset pipeline using Capistrano's default assets recipe. To enable assets support, add the following line to your Capfile

load 'deploy/assets'

The deploy/assets recipe will automatically handle asset precompilation for production environments during deployment. For more information, please see the official documentation.

During deployment, this links the folder specified in config.assets.prefix to shared/assets. If you already use this shared folder you'll need to write your own deployment task.

It is important that this folder is shared between deployments so that remotely cached pages that reference the old compiled assets still work for the life of the cached page.

docs/gemv2/assets.txt · Last modified: 2013/07/17 14:48 by ben