3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/zfben_libjs/helpers.rb', line 3
def lib *opts
html = ''
unless opts.blank?
preload = []
lib_preload = []
opts.each do |name|
name = name.to_s
if name.end_with?('.css') || name.end_with?('.js')
preload.push name
else
lib_preload.push name
end
end
if preload.length > 0
preload.each do |url|
if url.end_with?('.css')
html << lib_css(url)
else
html << lib_js(url)
end
end
end
html << lib_js('lib.js')
if lib_preload.length > 0
html << "<script>lib('#{lib_preload.join(' ')}')</script>"
end
end
return html
end
|