1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

Look for assets using url_for before falling back to the "images" directory

This commit is contained in:
Ben Hollis 2013-09-22 14:02:51 -07:00
parent 8a928863f2
commit f2538f2e54

View file

@ -176,6 +176,9 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
if path.include?('//') or path.start_with?('data:') if path.include?('//') or path.start_with?('data:')
path path
else # rewrite paths to use their destination path else # rewrite paths to use their destination path
if resource = sitemap.find_resource_by_destination_path(url_for(path))
resource.url
else
path = File.join(prefix, path) path = File.join(prefix, path)
if resource = sitemap.find_resource_by_path(path) if resource = sitemap.find_resource_by_path(path)
resource.url resource.url
@ -184,6 +187,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
end end
end end
end end
end
# Given a source path (referenced either absolutely or relatively) # Given a source path (referenced either absolutely or relatively)
# or a Resource, this will produce the nice URL configured for that # or a Resource, this will produce the nice URL configured for that