Skip to content

Instantly share code, notes, and snippets.

@lanceguyatt
Last active December 18, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanceguyatt/5704921 to your computer and use it in GitHub Desktop.
Save lanceguyatt/5704921 to your computer and use it in GitHub Desktop.
Modernizr retina background sass mixin
@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