Run javascript and css templates through erb.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 7 commits behind trotter:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Chuusha (pronounced chew-sha) is a Rack adapter that treats your css and javascript files as erb templates. It also provides a basic facility for sharing constants between all your templates and the rest of your Rack stack. It will continually evaluate templates in dev mode, while caching the rendered template in production. It plays nicely with Rails's asset caching.

Installation and Usage

First install the gem:

$ gem install chuusha

Next, require the gem and tell your rack application to use chuusha. You will need to point it at the directory containing your public assets.

# in ./
require 'chuusha'

use Chuusha::Rack, File.dirname(__FILE__) + '/public'
run"/" => YOUR_RAILS_APP::Application)

Now place a css erb template somewhere in '/public/stylesheets'

# in ./public/stylesheets/application.css.erb

<% highlight_color = "#fc6666" %>

p.highlight {
  color: <%= highlight_color %>;

div.highlight {
  border: 1px solid <%= highlight_color %>;


Chuusha is still pretty young and probably has bugs. Feel free to email me (Trotter Cashion) at if you find anything. Alternately, you can tweet me at @cashion, as I often respond more quickly to public humiliation :-).


Thanks to Mat Schaffer for the name.

Bogorman 10-Mar-11 Added a param to the initializer so that you can specify the output directory. This is so we can render to tmp folder on heroku. in its now

use Chuusha::Rack, File.dirname(FILE) + '/public', nil, File.dirname(FILE) + '/tmp'