Forked from alanhogan/compass-retina-sprites.scss
Last active
August 29, 2015 13:56
-
-
Save ambidexterich/8985532 to your computer and use it in GitHub Desktop.
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
$sprites: sprite-map("sprites/*.png"); | |
$sprites-retina: sprite-map("sprites-retina/*.png"); | |
@mixin sprite-background($name) { | |
background-image: sprite-url($sprites); | |
background-position: sprite-position($sprites, $name); | |
background-repeat: no-repeat; | |
@media (-webkit-min-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 3/2), (min-device-pixel-ratio: 2) { | |
background-image: sprite-url($icons-retina); | |
background-position: sprite-position($icons-retina, $name); | |
@include background-size(image-width(sprite-file($icons, $name)) auto); | |
} | |
} | |
// Usage. | |
.mail-icon { | |
@include sprite-background(mail); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment