Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handlebars block helpers screwed up in HAML

I need to use some handlebars block helpers inside of an element's attribute. How can I get

.some.class{:class => "{{if property}} otherClass {{/if}}"}

to parse properly? Here is the compiled output as is:

<div class='class otherClass property}} some {{/if}} {{if'></div>

I've tried escaping every non-word character, trying single quotes, and adjusting the spacing, but nothing seems to fix it. I'm hoping to find a more elegant solution than just using the :plain keyword.

like image 208
user1408632 Avatar asked May 21 '12 19:05

user1408632


1 Answers

I've found that you need to add some character before the {{}} for Haml to accept it. For example:

%div.some.class{:class => "a{{foo}}"}

Not idea, but suites my purposes.

like image 174
Gregg Kellogg Avatar answered Sep 28 '22 00:09

Gregg Kellogg