lib/hogan_assets/tilt.rb in hogan_assets-1.3.2 vs lib/hogan_assets/tilt.rb in hogan_assets-1.3.3
- old
+ new
@@ -10,10 +10,11 @@
# haml not available
end
def evaluate(scope, locals, &block)
template_path = TemplatePath.new scope
+ template_namespace = HoganAssets::Config.template_namespace
text = if template_path.is_hamstache?
raise "Unable to complile #{template_path.full_path} because haml is not available. Did you add the haml gem?" unless HoganAssets::Config.haml_available?
Haml::Engine.new(data, @options).render
else
@@ -24,11 +25,11 @@
template_name = scope.logical_path.inspect
# Only emit the source template if we are using lambdas
text = '' unless HoganAssets::Config.lambda_support?
<<-TEMPLATE
- this.HoganTemplates || (this.HoganTemplates = {});
- this.HoganTemplates[#{template_path.name}] = new Hogan.Template(#{compiled_template}, #{text.inspect}, Hogan, {});
+ this.#{template_namespace} || (this.#{template_namespace} = {});
+ this.#{template_namespace}[#{template_path.name}] = new Hogan.Template(#{compiled_template}, #{text.inspect}, Hogan, {});
TEMPLATE
end
protected