DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Dynamic CSS Stylesheets In Rails
Found <a href="http://blog.hasmanythrough.com/articles/2006/03/23/dirt-simple-rcss-templates">here (with more info).</a> Probably the best new Rails blog around at the moment.
class StylesheetsController < ApplicationController
layout nil
session :off
def rcss
if rcss = params[:rcss]
file_base = rcss.gsub(/.css$/i, '')
file_path = "#{RAILS_ROOT}/app/views/stylesheets/#{file_base}.rcss"
@color = '#f77' # example setting
render(:file => file_path, :content_type => "text/css")
else
render(:nothing => true, :status => 404)
end
end
end




