Somewhat related, I am looking at sprite generation and the use of
SASS mixins to easily incorporate background positions in various CSS
defs. We are using the "sprite" gem (
https://github.com/merbjedi/
sprite) and its output is something like the following (mirroring
Christian's solution above). Our generated mixin, as it has to include
all sprite files in our very large web app, is 1100+ lines long.
Clearly there are some organizational things we can do, but am
wondering whether there might be some way to generate key/value tables
that would allow e.g. a command
+sprite("groupname", "spritename")
to reference a string/value table in order to access values or even a
SASS list. This string/value table would be generated using the sprite
generation tool. Thoughts?
Thanks,
Eric
= sprite(!group_name, !image_name, !offset=0)
@if !group_name == "profile" and !image_name == "add"
background: url('/images/sprites/profile.png?1305666298') no-
repeat 0px #{0+!offset}px
width: 59px
height: 24px
@else if !group_name == "profile" and !image_name == "add_disabled"
background: url('/images/sprites/profile.png?1305666298') no-
repeat 0px #{-44+!offset}px
width: 59px
height: 24px
@else if !group_name == "profile" and !image_name == "contract"
background: url('/images/sprites/profile.png?1305666298') no-
repeat 0px #{-88+!offset}px
width: 10px
height: 10px
@else if !group_name == "profile" and !image_name == "expand"
background: url('/images/sprites/profile.png?1305666298') no-
repeat 0px #{-118+!offset}px
width: 10px
height: 10px
On May 26, 6:14 am, Christian Peters <
crispy....@googlemail.com>
wrote: