views:

20

answers:

1

What's the best way to parse a css file, and get a list of all the css (using @imports), and the images that are referenced as background-images etc? Is there any parser for css available in ruby??

A: 

We use LESS CSS to parse stylesheets to validate their syntax among other things.

require 'less'
Less.parse "div { width: 1 + 1 }"
Andy Atkinson