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:
parent
8a928863f2
commit
f2538f2e54
1 changed files with 8 additions and 4 deletions
|
@ -13,7 +13,7 @@ if !defined?(::Padrino::Helpers)
|
||||||
require 'vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite'
|
require 'vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite'
|
||||||
require 'vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers'
|
require 'vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers'
|
||||||
end
|
end
|
||||||
|
|
||||||
class Padrino::Helpers::OutputHelpers::ErbHandler
|
class Padrino::Helpers::OutputHelpers::ErbHandler
|
||||||
# Force Erb capture not to use safebuffer
|
# Force Erb capture not to use safebuffer
|
||||||
def capture_from_template(*args, &block)
|
def capture_from_template(*args, &block)
|
||||||
|
@ -176,11 +176,15 @@ 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
|
||||||
path = File.join(prefix, path)
|
if resource = sitemap.find_resource_by_destination_path(url_for(path))
|
||||||
if resource = sitemap.find_resource_by_path(path)
|
|
||||||
resource.url
|
resource.url
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue