Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid repetition in template compilation

  • Loading branch information...
commit 00c109e5a3d28f92067cfa145d921988b2ddcc88 1 parent 90fba64
@lautis lautis authored
Showing with 4 additions and 6 deletions.
  1. +4 −6 lib/hogan_assets/tilt.rb
View
10 lib/hogan_assets/tilt.rb
@@ -11,16 +11,14 @@ def initialize_engine
end
def evaluate(scope, locals, &block)
- text = data # Ugly, yes, but to not taint data variable
-
- if scope.pathname.extname == '.hamstache'
+ text = if scope.pathname.extname == '.hamstache'
raise "Unable to complile #{scope.pathname} because haml is not available. Did you add the haml gem?" unless HoganAssets::Config.haml_available?
- text = Haml::Engine.new(data, @options).render
- compiled_template = Hogan.compile(text)
+ Haml::Engine.new(data, @options).render
else
- compiled_template = Hogan.compile(data)
+ data
end
+ compiled_template = Hogan.compile(text)
template_name = scope.logical_path.inspect
# Only emit the source template if we are using lambdas
Please sign in to comment.
Something went wrong with that request. Please try again.