These are good tips, but it doesn't eliminate the additional production time required to use sprites. You still have to combine all the images into one, then take time to position them where you want.
The tips speed up production with sprites, but it's still faster to produce sites without using sprites.
If you're combining images into one at any point, then there's probably a better way to do it. If you design from the beginning with CSS sprites in mind, you should always be working from your spritemap image. Then it's a matter of time spent positioning vs. time spent managing the images themselves in your document, which I've found to be pretty even.
I really didn't touch on this as much as I would like in the post. Would a process post on this be of interest to you?
If you're using photoshop it's really easy to automate the creation of the sheet. Dealing with the coordinates is just a matter of using the right conventions and sticking to them.
is there a tool (preferably a rails plugin or gem, or rack middleware, but hosted web service would be fine too) that will take images linked to in a site's css and auto-sprite them, fixing up the css at the same time?
I'd categorically recommend against all of them, however. I feel it's a better practice to manage it yourself. Of course, if you need to convert multiple sites fast, they might be worth a try.
Cool library I've been working on (still early in dev, but I'm using it to generate production assets):
http://github.com/merbjedi/sprite
It's a ruby executable (no ruby knowledge required to use it though) that easily generates sprite files and css from a directory structure. It defaults to something sane, but you can overwrite it via config/sprite.yml
Install it via:
gem install sprite
Then run it via:
sprite
Check out the README to learn how to configure. If anyone knows their way around ImageMagick on the command line, please msg me on github (merbjedi). Would love your help on 4 lines of RMagick code I need to get converted so I can remove this dependency.
10 comments
[ 3.3 ms ] story [ 26.6 ms ] threadThe tips speed up production with sprites, but it's still faster to produce sites without using sprites.
I really didn't touch on this as much as I would like in the post. Would a process post on this be of interest to you?
It would to me. I have some interest in CSS sprites, but working with them always seems cumbersome.
I'd categorically recommend against all of them, however. I feel it's a better practice to manage it yourself. Of course, if you need to convert multiple sites fast, they might be worth a try.
It's a ruby executable (no ruby knowledge required to use it though) that easily generates sprite files and css from a directory structure. It defaults to something sane, but you can overwrite it via config/sprite.yml
Install it via:
Then run it via: Check out the README to learn how to configure. If anyone knows their way around ImageMagick on the command line, please msg me on github (merbjedi). Would love your help on 4 lines of RMagick code I need to get converted so I can remove this dependency.