CSS Dryer plugin
Plugin details
Documentation
ruby script/plugin install http://opensource.airbladesoftware.com/trunk/plugins/css_dryer/
Create a controller to serve your DRY stylesheets:
script/generate controller stylesheets
You don't have to call it stylesheets but doing so lets you use Rails' stylesheet_link_tag helper.
Edit the controller so it looks like this:
class StylesheetsController < ApplicationController
before_filter :set_headers
after_filter { |c| c.cache_page }
session :off
layout nil
private
def set_headers
headers['Content-Type'] = 'text/css; charset=utf-8'
end
end
Add this line to your routes in config/routes.rb (note the full stop immediately after the word action):
map.connect 'stylesheets/:action.:format', :controller => 'stylesheets'
You can then put your stylesheets, DRY or otherwise, in app/views/stylesheets/. Once rendered they will be cached in public/stylesheets/.
DRY stylesheet files should have a ncss extension -- think 'n' for nested. For example, site.ncss.
Get them in your views with a css extension with Rails' stylesheet_link_tag helper:
<%= stylesheet_link_tag 'site' %>
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (2 older versions) | Last edited by: hardway, 8 months ago

