Created
June 28, 2017 15:06
-
-
Save winwu/3da5847be9268535b4f77f224aa6d8b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* example: @include background@2x( 'path/to/image', 'png', repeat-x); | |
*/ | |
@mixin background_2x($path, $ext: "png", $repeat: no-repeat) { | |
$at1x_path: "#{$path}.#{$ext}"; | |
$at2x_path: "#{$path}@2x.#{$ext}"; | |
background-image: url("#{$at1x_path}"); | |
background-repeat: $repeat; | |
@media all and (-webkit-min-device-pixel-ratio : 1.5), | |
all and (-o-min-device-pixel-ratio: 3/2), | |
all and (min--moz-device-pixel-ratio: 1.5), | |
all and (min-device-pixel-ratio: 1.5) { | |
background-image: url("#{$at2x_path}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment