Skip to content

Instantly share code, notes, and snippets.

@askehansen
Created March 2, 2016 10:44
Show Gist options
  • Save askehansen/6068f671c877fcbfd70c to your computer and use it in GitHub Desktop.
Save askehansen/6068f671c877fcbfd70c to your computer and use it in GitHub Desktop.
def image_2x_tag(img, opts={})
x2_img = img.gsub(/(.+)(\.\w+)/, '\1@2x\2')
x2_path = image_path(x2_img)
opts[:srcset] = "#{x2_path} 2x"
image_tag(img, opts)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment