css_dryer: DRY Up Your CSS

css_dryer is a Rails plugin by Andrew Stewart that makes putting together stylesheets for your Rails applications more efficient than ever before. It supports nesting and basic variable interpolation. For example, here's an example of nesting:

div {
  /* comment for div */
  color: green;
  p {
    /* comment for div p */
    color: red;
    b { color: blue; }
  }
}

And using variables makes it easy to update constants in your stylesheet:

<% sleek_grey = '#fefefe' %>
#sidebar { border: 1px solid  <%= sleek_grey %> }
#footer  { footer: 1px dashed <%= sleek_grey %> }

Andrew has put together some great instructions on how to get it all going here.

Comments

  1. Sandro ·

    Do you know if there is a caching mechanism inside this plugin ? Thank you.

  2. Andrew Stewart ·

    Hi Sandro, there's no caching mechanism at the moment but it's high up on the to-do list.

  3. Andrew Stewart ·

    Sandro, I've just released an update to the plugin and it now caches stylesheets.