Skip to content

Instantly share code, notes, and snippets.

@rileyjshaw
Last active August 29, 2015 14:06
Show Gist options
  • Save rileyjshaw/07bb827c0739c92cab43 to your computer and use it in GitHub Desktop.
Save rileyjshaw/07bb827c0739c92cab43 to your computer and use it in GitHub Desktop.
Retina sprites compass mixin
=retina-sprites($spritesheet)
@each $sprite in sprite_names($spritesheet)
&.#{$sprite}
$positions: ''
@each $j in sprite-position($spritesheet, $sprite)
$positions: append($positions, $j / 2, space)
height: image-height(sprite-file($spritesheet, $sprite)) / 2
width: image-width(sprite-file($spritesheet, $sprite)) / 2
background-position: $positions
background-image: $spritesheet
background-size: image-width($spritesheet)/2 image-height($spritesheet)/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment