13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/middleman-sprockets/extension/context_methods.rb', line 13
def asset_path path, options={}
if path.is_a?(::Symbol) && !options.is_a?(::Hash)
kind = path
path = options
else
kind = {
image: :images,
font: :fonts,
javascript: :js,
stylesheet: :css
}.fetch(options[:type], options[:type])
end
if File.extname(path).empty?
path << { js: '.js', css: '.css' }.fetch(kind, '')
end
if app.extensions[:sprockets].check_asset(path)
link_asset(path)
File.join *[app.config[:http_prefix],
app.extensions[:sprockets].sprockets_asset_path(env[path])].compact
else
app.asset_path(kind, path)
end
end
|