Created
October 21, 2013 15:24
-
-
Save shkm/7085724 to your computer and use it in GitHub Desktop.
Retina sprites. Given a normal and retina sprite map, along with the name of the sprite, this does magic things. Requires a retina mixin, such as https://gist.github.com/shkm/7085706
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include normal and retina sprites. Requires retina mixin. | |
@mixin retina-sprite($map-1x, $map-2x, $sprite, $dimensions: true) { | |
$position-1x: sprite-position($map-1x, $sprite); | |
background: sprite-url($map-1x) $position-1x no-repeat; | |
@if $dimensions { | |
@include sprite-dimensions($map-1x, $sprite); | |
} | |
@include retina { | |
$map-path-1x: sprite-path($map-1x); | |
$map-width-1x: image-width($map-path-1x); | |
$map-height-1x: image-height($map-path-1x); | |
background-image: sprite-url($map-2x); | |
background-size: $map-width-1x $map-height-1x; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment