Skip to content

Instantly share code, notes, and snippets.

@KOWLOR
Created July 23, 2015 09:02
Show Gist options
  • Save KOWLOR/1c1e6ec8e19a9ee0954f to your computer and use it in GitHub Desktop.
Save KOWLOR/1c1e6ec8e19a9ee0954f to your computer and use it in GitHub Desktop.
Middleman retina_image_tag
helpers do
def retina_image_tag(default_name, options={})
retina_name = default_name.gsub(%r{\.\w+$}, '@2x\0')
image_tag(default_name, options.merge('data-interchange' => "[#{asset_path(:images, retina_name)}, (retina)]"))
end
end
@KOWLOR
Copy link
Author

KOWLOR commented Jul 23, 2015

Using the data-interchange by foundation.
Place this snippet in config.rb, make sure foundation.js and foundation.interchange.js are called
And also :

$ ->
  $(document).foundation()

Use like this :

= retina_image_tag 'path/of/the/pic.jpg'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment