Skip to content

Instantly share code, notes, and snippets.

@mrmurphy
Created December 6, 2013 01:00
Show Gist options
  • Save mrmurphy/7816979 to your computer and use it in GitHub Desktop.
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.
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