jakesgordon/sprite-factory — Issue #12: Automatic selectors
Author: BadMinus
Created: 2012-02-29 04:27:46+00:00
State: open

Wouldn't be great if was an option when you can write selectors in filenames. Often I know how I will use image so why don't write selectors in filename?
body__div#main_shit__ul__li__a.class.double-dragon--hover.png
or even with whitespace body div#main_shit ul li a.class.double-dragon--hover.png
We can pass an options like repeat-x .class(rx).png => .class{background-image:url(sprites.png) repeat-x}

I don't know how to write this beautifully so it just idea yet.

Sample code
````ruby
def self.css(selector, name, attributes)
if selector == 'filename'
name = name.gsub(/--/,":")
name = name.gsub(/__/," ")
"#{name} { #{css_style(attributes)}; }"
else
"#{selector}#{name} { #{css_style(attributes)}; }"
end
end
````