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

Commit

Permalink
Add to retina_srcset method to accomodate uploading images via netlif…
Browse files Browse the repository at this point in the history
…y cms
  • Loading branch information
cdccollins committed Sep 20, 2019
1 parent ffa1d7f commit 5e3fb44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
module Helpers
def retina_srcset(path)
return "#{path}" if path =~ /^http(s)?/
"#{path.gsub(/\./, '@2x.')} 2x"
if File.exist?("source/#{path.gsub(/\./, '@2x.')}")
"#{path.gsub(/\./, '@2x.')} 2x"
elsif File.exist?("source/#{path.gsub(/\./, '-2x.')}")
"#{path.gsub(/\./, '-2x.')} 2x"
end
end

def site_nav_link(link_text, href, options = {})
Expand Down

0 comments on commit 5e3fb44

Please sign in to comment.