Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

css_dryer: DRY Up Your CSS

By Peter Cooper / December 17, 2006

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 says:

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

  2. Andrew Stewart says:

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

  3. Andrew Stewart says:

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

Other Posts to Enjoy

Twitter Mentions