Merge pull request #1017 from bhollis/url_for

Look for assets using url_for before falling back to the "images" directory
This commit is contained in:
Thomas Reynolds 2013-09-24 23:33:53 -07:00
commit d842db1772

View file

@ -176,11 +176,15 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
if path.include?('//') or path.start_with?('data:')
path
else # rewrite paths to use their destination path
path = File.join(prefix, path)
if resource = sitemap.find_resource_by_path(path)
if resource = sitemap.find_resource_by_destination_path(url_for(path))
resource.url
else
File.join(config[:http_prefix], path)
path = File.join(prefix, path)
if resource = sitemap.find_resource_by_path(path)
resource.url
else
File.join(config[:http_prefix], path)
end
end
end
end