Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Allow ERB templating in combination with Eco templates #2

Open
jonhyman opened this issue May 9, 2012 · 5 comments
Open

Allow ERB templating in combination with Eco templates #2

jonhyman opened this issue May 9, 2012 · 5 comments

Comments

@jonhyman
Copy link

jonhyman commented May 9, 2012

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?

@mattiassvedhem
Copy link

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.

@mateusmaso
Copy link

+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.

@sos4nt
Copy link

sos4nt commented Oct 2, 2012

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.

@mattiassvedhem
Copy link

Awesome @sos4nt will try that. Thanks.

@dougvk
Copy link

dougvk commented Nov 14, 2013

what if I wanted to do something like

<%= text_field_tag 'title', '<%%= @title %>' %>

currently this doesn't work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants