Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Feature request: handling hover states #14

nedbaldessin opened this Issue Mar 12, 2012 · 2 comments


None yet
2 participants

It would be nice to have a way to handle "hover" states for sprites. At the moment, I'm adopting a naming convention ("foobar_off.png" and "foobar_on.png"), with this customization :

    SpriteFactory.run!('app/assets/images/sprite', :output_style => 'app/assets/stylesheets/sprite.css.erb') do |images|
      rules = []
      images.each do |k, v|
        rules << ".#{k} { #{v[:style]} }"
        if k.to_s =~ /_on$/
          rules << ".#{k.to_s.gsub(/_on$/, '_off')}:hover { #{v[:style]} }"

…but maybe this could be elegantly integrated into the package?


jakesgordon commented Mar 24, 2012

Good idea, I'd have to think about the simplest way to make hover states configuration (instead of custom code)...

... in general I think the gem would benefit from some simpler ways to customize instead of the 'do it all yourself' catch-all #run block.

I'll try and add something out in a future release.

jakesgordon added a commit that referenced this issue May 10, 2012


jakesgordon commented May 11, 2012

This is fixed in master branch and included in new release of the sprite-factory gem (v1.5.0). You can read about it on codeincomplete.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment