开发者

Custom ERB tag replacement

开发者 https://www.devze.com 2022-12-21 03:37 出处:网络
How can I get ERB to replace tags in a format other than 开发者_StackOverflow<%= %> for example:

How can I get ERB to replace tags in a format other than

开发者_StackOverflow
<%= %>

for example:

{{   }}

Thanks


Maybe something like this:

ERB.new(your_template.gsub("{{", "<%=").gsub("}}", "%>")).result

I don't think there is an option to tell ERB to use different tags.

But you can use liquid library which uses this curly braces syntax.


I believe ERb also supports inline interpolated strings (#{}) in place of percent brackets, so perhaps that might better suit your needs?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号