class Middleman::CoreExtensions::DefaultHelpers
def asset_path(kind, source)
-
(String)
-
Parameters:
-
source
(String
) -- The path to the file -
kind
(Symbol
) -- The type of file
def asset_path(kind, source) return source if source.to_s.include?('//') || source.to_s.start_with?('data:') asset_folder = case kind when :css then css_dir when :js then js_dir when :images then images_dir when :fonts then fonts_dir else kind.to_s end source = source.to_s.tr(' ', '') ignore_extension = (kind == :images || kind == :fonts) # don't append extension source << ".#{kind}" unless ignore_extension || source.end_with?(".#{kind}") asset_folder = "" if source.start_with?('/') # absolute path asset_url(source, asset_folder) end