Last active
December 10, 2015 19:19
-
-
Save tylerpearson/4480482 to your computer and use it in GitHub Desktop.
LESS mixin to make optimization for Retina and high-dpi screens easier.
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
// media queries are escaped to prevent potential LESS rendering errors | |
// adapted from http://37signals.com/svn/posts/3271-easy-retina-ready-images-using-scss | |
@mediaRetina: ~"(min-resolution: 124dpi), (-webkit-min-device-pixel-ratio: 1.3), (min--moz-device-pixel-ratio: 1.3), (-o-min-device-pixel-ratio: 4/3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx)"; | |
.image-2x(@image, @width, @height) { | |
@media @mediaRetina { | |
background-image: url('@{image}'); | |
background-size: @width @height; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment