Fix asset_url with asset_hash (#1919)

* Fix asset_url with asset_hash.

* Fix asset hashes.
fix/fix-watcher-config
Ben Hollis 2016-05-22 12:31:53 -07:00 committed by Thomas Reynolds
parent 5de9e86a55
commit 38a9025560
2 changed files with 10 additions and 1 deletions

View File

@ -118,7 +118,9 @@ module Middleman
# relative path, since it only takes absolute url paths.
dest_path = url_for(app, path, options.merge(relative: false))
result = if resource = app.sitemap.find_resource_by_destination_path(dest_path)
result = if resource = app.sitemap.find_resource_by_path(dest_path)
resource.url
elsif resource = app.sitemap.find_resource_by_destination_path(dest_path)
resource.url
else
path = ::File.join(prefix, path)

View File

@ -162,6 +162,13 @@ describe Middleman::Util do
expect( Middleman::Util.asset_url( @mm, '/how/about/that.html' ) ).to eq '/how/about/that/'
end
it "returns a resource url when asset_hash is on" do
Given.fixture 'asset-hash-app'
@mm = Middleman::Application.new
expect( Middleman::Util.asset_url( @mm, '100px.png', 'images') ).to match %r|/images/100px-[a-f0-9]+.png|
end
end
describe "::find_related_files" do