-
-
Save PelagicDev/a23868e628221dcc8e32b05ba2675a8d to your computer and use it in GitHub Desktop.
[ruby on rails] - Image helper for retina display with foundation interchange
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
module ApplicationHelper | |
def retina_image_tag(default_name, options={}) | |
retina_name = default_name.gsub(%r{\.\w+$}, '@2x\0') | |
retina_image_tag(default_name, options.merge('data-interchange' => "[#{asset_path(retina_name)}, (retina)]")) | |
end | |
end |
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
= image_tag('front/static/logo.png', alt: 'Description', 'data-interchange' => "[#{image_path('front/static/[email protected]')}, (retina)]") |
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
<img src="/assets/front/static/global/logo.png" data-interchange="[/assets/front/static/global/[email protected], (retina)]" alt="Description"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment