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
41
42
43
44
45
|
# File 'lib/rails_ember_templates/template.rb', line 13
def evaluate(scope, locals, &block)
raw = handlebars?(scope)
if raw
template = data
else
template = mustache_to_handlebars(scope, data)
end
if configuration.precompile
if raw
template = precompile_handlebars(template)
else
template = precompile_ember_handlebars(template)
end
else
if raw
template = compile_handlebars(data)
else
template = compile_ember_handlebars(template)
end
end
if configuration.output_type == :amd
target = amd_template_target(scope)
"define('#{target}', ['exports'], function(__exports__){ __exports__.default = #{template} });"
else
target = global_template_target(scope)
"#{target} = #{template}\n"
end
end
|