Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…tories.
  • Loading branch information...
commit 97501eb5771bf687d001c562acb24889fffb46c3 1 parent 4fe9cd8
Rob Holland authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/handlebars_assets/tilt_handlebars.rb
8 lib/handlebars_assets/tilt_handlebars.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.