27 Apr
RCSS, who woulda thought!
DRY, DRY!, DRY!!
Rails Developer's dream, take something like this:
graph.css:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#vertgraph li.critical { left: 25px; background-position: 0px bottom !important; } #vertgraph li.high { left: 100px; background-position: -28px bottom !important; } #vertgraph li.medium { left: 175px; background-position: -56px bottom !important; } #vertgraph li.low { left: 250px; background-position: -84px bottom !important; } #vertgraph li.info { left: 325px; background-position: -112px bottom !important; } |
And using rcss turn it into this:
graph.rcss:
1 2 3 4 5 6 7 8 |
<% %w{critical high medium low info}.each do | severity, i | %> #vertgraph li.<%= severity %> { left: <%= 25 * (3 * i + 1) %>px; background-position: <%= i * 28 %>px bottom !important; } <% end %> |
Learn more about RCSS here.
Sorry, comments for this entry are closed at this time.