Permalink
Browse files

Use the full partial name to avoid collisions between different direc…

…tories.
  • Loading branch information...
1 parent 4fe9cd8 commit 97501eb5771bf687d001c562acb24889fffb46c3 Rob Holland committed Nov 22, 2011
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/handlebars_assets/tilt_handlebars.rb
@@ -11,14 +11,14 @@ def evaluate(scope, locals, &block)
compiled_hbs = Handlebars.precompile(data)
if name.starts_with?('_')
- partial_name = name[1..-1].inspect
+ partial_name = scope.logical_path.sub(/#{name}$/, name[1..-1]).to_s
<<-PARTIAL
(function() {
Handlebars.registerPartial(#{partial_name}, Handlebars.template(#{compiled_hbs}));
}).call(this);
PARTIAL
else
- template_name = scope.logical_path.inspect
+ template_name = scope.logical_path.to_s
<<-TEMPLATE
function(context) {
return HandlebarsTemplates[#{template_name}](context);
@@ -30,9 +30,9 @@ def evaluate(scope, locals, &block)
end
protected
-
+
def basename(path)
- path.gsub(%r{.*/}, '')
+ path.sub(%r{.*/}, '')
end
def prepare; end

0 comments on commit 97501eb

Please sign in to comment.