Allow ERB templating in combination with Eco templates
A lot of my Eco templates in Rails have an image in them. Ideally, I'd love to name my file template.js.eco.erb and be able to use <%= image_tag ... %>. However, due to the template syntax being the same, this won't work.
Is there a recommended way to do this? Should I switch off ERB to Haml or some other templating engine?
I've also been wanting to do this, but never got to looking any closer at it. For now, I just pass down the URL when rendering the templates. It works, but doesn't feel quite right.
+1 same problem here.. would like to use <%= asset_path ... %> tags but isn't possible yet. Some workaround is to name the file jst.erb.eco and use <%%= asset_path ... %> instead, but as @yeggeps said it doesnt feel right.
The file ending should be .eco.erb. Everything within <% %> is handled by ERB, whereas everything within <%% %> is handled by Eco:
<%= image_tag('icon.png') %>
<%%= @eco_variable %>
This is because ERB replaces <%% with <% which is then processed by Eco as usual.
Awesome @sos4nt will try that. Thanks.
what if I wanted to do something like
<%= text_field_tag 'title', '<%%= @title %>' %>
currently this doesn't work