Module: Roda::RodaPlugins::AssetsPreloading::InstanceMethods

Defined in:
lib/roda/plugins/assets_preloading.rb

Instance Method Summary collapse

Instance Method Details

Return a string suitable for a Link header for the given asset types/groups.



67
68
69
# File 'lib/roda/plugins/assets_preloading.rb', line 67

def preload_assets_link_header(*args)
  _preload_assets_array(args).map{|path, as| "<#{path}>;rel=preload;as=#{as}"}.join(",")
end

Return a string of <link> tags for the given asset types/groups.



61
62
63
# File 'lib/roda/plugins/assets_preloading.rb', line 61

def preload_assets_link_tags(*args)
  _preload_assets_array(args).map{|path, as| "<link href=\"#{h(path)}\" rel=\"preload\" as=\"#{as}\">"}.join("\n")
end