Is there a Ruby gem that can generate CSS sprites from PNG images by combining them into a GIF?
I am looking for one that supports command line. I found several but they either work only with Rails or can only produce PNG sprites, never gifs.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Another big caveat with GIF is that you’re limited to a 256-color palette, which is often fine for a single image but could be problematic if your sprites vary widely in palette. Regardless…
css_sprite (the first result for this gem search) looks like your best bet.
You probably found it on your own and disregarded it because it appears to depend on Rails. However, peeking at the code shows that in fact it doesn’t. Running it as specified should work as long as your configuration file is specified.*
*It looks like the
css_sprite:buildRake task might break without Rails (because it doesn’t requirelib/automatic.rb, which “fakes”Rails.root) but usingrake css_sprite:startshould work fine.