class Middleman::CoreExtensions::DefaultHelpers

def asset_url(path, prefix="")

Returns:
  • (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?('//') or path.start_with?('data:')
    path
  else # rewrite paths to use their destination path
    if resource = sitemap.find_resource_by_destination_path(url_for(path))
      resource.url
    else
      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