Wednesday, 4 September 2013

Node projects with Underscore template delimeters conflicting in EJS views

Node projects with Underscore template delimeters conflicting in EJS views

Have backbone project using underscore templates. Using nodejs on the
server and rendering views with EJS. Underscore templates use the same
delimiters as EJS and because the underscore templates are in my .ejs
views as inline script tags I am getting errors. I tried the below
solution:
app.set('view options', {
open: '{{',
close: '}}'
});
It still appears to be trying to render the underscore template and
throwing an error:
<h2><%= title %></h2>
title is not defined
It seems using a custom delimiter in EJS just adds to the type of tags
that are accepted instead of changing them. I also couldn't find a way to
spit out raw html like you can in haml.
page btwn gough and franklin

No comments:

Post a Comment