7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/clean_shaved/helpers.rb', line 7
def template_for(*args, &block)
name = args.first
options = args..to_options!
tmpl = capture(&block)
if CleanShaved.config.compile?
script_ type: 'text/javascript' do
"Handlebars.templates['#{name}'] = Handlebars.template(#{CleanShaved.compile(name, tmpl)});"
.gsub(/\s+/, ' ')
end
else
options[:type] ||= "text/x-handlebars-template"
options[:class] ||= "template"
options[:name] ||= name
script_(options) do
tmpl
end
end
end
|