Module: Middleman::CoreExtensions::Assets::InstanceMethod
- Defined in:
- lib/middleman-more/core_extensions/assets.rb
Overview
Methods to be mixed-in to Middleman::Application
Instance Method Summary collapse
-
#asset_url(path, prefix = "") ⇒ String
Get the URL of an asset given a type/prefix.
Instance Method Details
#asset_url(path, prefix = "") ⇒ String
Get the URL of an asset given a type/prefix
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/middleman-more/core_extensions/assets.rb', line 27 def asset_url(path, prefix="") # Don't touch assets which already have a full path if path.include?("//") path else # rewrite paths to use their destination path path = File.join(prefix, path) if resource = sitemap.find_resource_by_path(path) resource.url else File.join(http_prefix, path) end end end |