Created
December 6, 2013 01:00
-
-
Save mrmurphy/7816979 to your computer and use it in GitHub Desktop.
An example of some Coffeescript to swap out retina images for 1x images.
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
retinizePath = (path) -> | |
path_split = path.split(".") | |
prefix = path_split[0..-2].join(".") | |
suffix = path_split[path_split.length - 1] | |
if window.devicePixelRatio > 1 | |
return [prefix, suffix].join("@2x.") | |
else | |
return [prefix, suffix].join(".") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment