Last active
December 18, 2015 01:39
-
-
Save lanceguyatt/5704921 to your computer and use it in GitHub Desktop.
Modernizr retina background sass mixin
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
@mixin background-image-retina($file, $type) { | |
$image-normal: $file + '.' + $type; | |
$image-retina: $file + '@2x.' + $type; | |
$height: image-height($image-normal); | |
$width: image-width($image-normal); | |
background: image-url($image-normal) no-repeat 0 0; | |
height: $height; | |
width: $width; | |
.backgroundsize & { | |
background-image: image-url($image-retina); | |
background-size: $width $height; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment