deface
deface copied to clipboard
ERB in line comments break template rendering e.g. <% # comment %>
I was investigating some failures in spree_i18n build and tracked it down to deface overrides. For some reason every time we try to override something in a template, which has erb inline comments, with deface the rendering process breaks.
To reproduce you can place a partial like this in a fresh Spree 2.1 app:
app/views/spree/shared/_nav_bar.html.erb (this is overridden in spree_auth_devise)
<nav id="top-nav-bar" class="columns ten">
<ul id="nav-bar" class="inline" data-hook>
<li id="search-bar" data-hook>
<% # comment %>
<%= render :partial => 'spree/shared/search' %>
</li>
</ul>
</nav>
You should get a very confusing SyntaxError. The same code doesn't generate any error in Spree 2.0.x (which runs Rails 3.2.x). I'm on ruby 2.0.0. Applying the comment like this however <%# comment %>
doesn't error.
Curious to know if you guys have any clue on what's happening here?
same here, override failling for https://github.com/spree/spree/blob/master/backend/app/views/spree/admin/taxons/edit.html.erb
I encounter this same issue in 1-3-stable which uses deface 1.0.0 when I try to use deface to make a change to spree/admin/payment_methods/_form.html.erb because that view has an inline comment.
additional info: i'm using Rails 3.2.14, and ruby 1.9.3p393