Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit 5e3fb44

Browse files
committed
Add to retina_srcset method to accomodate uploading images via netlify cms
1 parent ffa1d7f commit 5e3fb44

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/helpers.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
module Helpers
66
def retina_srcset(path)
77
return "#{path}" if path =~ /^http(s)?/
8-
"#{path.gsub(/\./, '@2x.')} 2x"
8+
if File.exist?("source/#{path.gsub(/\./, '@2x.')}")
9+
"#{path.gsub(/\./, '@2x.')} 2x"
10+
elsif File.exist?("source/#{path.gsub(/\./, '-2x.')}")
11+
"#{path.gsub(/\./, '-2x.')} 2x"
12+
end
913
end
1014

1115
def site_nav_link(link_text, href, options = {})

0 commit comments

Comments
 (0)