module Roda::RodaPlugins::AssetsPreloading::InstanceMethods
def _preload_assets_array(assets)
Return an array of paths/as pairs for the given asset
def _preload_assets_array(assets) assets.map do |type| paths = assets_paths(type) type = type[0] if type.is_a?(Array) as = TYPE_AS[type] paths.map{|path| [path, as]} end.flatten(1) end
def preload_assets_link_header(*args)
Return a string suitable for a Link header for the
def preload_assets_link_header(*args) _preload_assets_array(args).map{|path, as| "<#{path}>;rel=preload;as=#{as}"}.join(",") end
def preload_assets_link_tags(*args)
Return a string of tags for the given asset
def preload_assets_link_tags(*args) _preload_assets_array(args).map{|path, as| "<link href=\"#{h(path)}\" rel=\"preload\" as=\"#{as}\">"}.join("\n") end