Created
March 17, 2015 15:16
-
-
Save iign/d5ed575dc773286ae0ad to your computer and use it in GitHub Desktop.
3x support for retina.less 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
.at2x(@path, @w: auto, @h: auto) { | |
background-image: url(@path); | |
@at2x_path: ~`@{path}.replace(/\.\w+$/, function(match) { return "@2x" + match; })`; | |
@at3x_path: ~`@{path}.replace(/\.\w+$/, function(match) { return "@3x" + match; })`; | |
@media @highdpi { | |
background-image: url("@{at2x_path}"); | |
background-size: @w @h; | |
} | |
@media @3xdpi { | |
background-image: url("@{at3x_path}"); | |
background-size: @w @h; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment