module Middleman::CoreExtensions::Assets::InstanceMethod
def asset_url(path, prefix="")
-
(String)
- The fully qualified asset url
Parameters:
-
prefix
(String
) -- The type prefix (such as "images") -
path
(String
) -- The path (such as "photo.jpg")
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) path = resource.destination_path end File.join(http_prefix, path) end end