I use ror3 + backbone.js and ejs + haml + haml_assets for templating. I need to use if/else statement in template. In jst.ejs template i can:
<% if(address != '') {%>
<li><%= address %></li>
<% } %>
But in jst.ejs.haml it not work. How can i use js statements in haml templating?
I haven’t actually tried this, but it looks like you can use haml.js to achieve this.
That way, your particular code snippet would look like this:
Haml has a way of doing weird things with some parts of the languages it uses (removing {} here, obviously), though, so the above doesn’t really look much like javascript any longer…