CSSPool

What is CSSPool?

CSSPool (pronounced "cesspool") is a CSS parser. It is a SAC parser (similar to SAX), and it validates.

What can I use it for?

You can use CSSPool for:
  • Eliminating duplicate rules.
  • Searching for rules.
  • Adding or modifying rules and properties.

Quickstart

require 'csspool' sac = CSS::SAC::Parser.new doc = sac.parse(DATA.read) doc.rules.each do |rule| puts rule.selector.to_css rule.properties.each do |property| p property end end __END__ h1 { background: red; }

Some Links