I have a list of icon class names like
auth-single-multi,auth-batch,auth-file,auth-imp-file,auth-man-fund-tran
I want to loop through this list (100 icons in total) and define a class for each where each icon's background-position-y property is 25px less than the previous icon value
.auth-single-multi { background-position:0 0;}
.auth-batch { background-position:0 -25px;}
.auth-file { background-position:0 -50px;}
.auth-imp-file { background-position:0 -75px;}
...
...
...
I'm using the latest version of Sass so would be keen to use some new features such as maps.
Any suggestions on the best way to approach this would be welcome.
I always use compass for this. it works quite well for icons and can generate the sprite file for you. A tutorial is available I find using compass especially useful when setting up a new project with a often changing set of icons.
Check out the @each feature, and combine it with a simple iterator and it'll do what you need:
You'll get css just like what you're after:
So, all you need is a list of your icons, then just do a little math!
Here is what i came up with. Output comes out like
SASS