Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Dynamic CSS Stylesheets In Rails

DZone's Guide to

Dynamic CSS Stylesheets In Rails

·
Free Resource
Found here (with more info). 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
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}