ejs-loader
ejs-loader copied to clipboard
reversed <%- %> and <%= %>
Escaped output with <%= %> (escape function configurable) Unescaped raw output with <%- %>
but my test results is reversed
test code:
<div><%- '<img/>'%></div>
results:
<div><img/></div>
the write results should be:
<div><img/></div>
Is this a documentation issue? Please send a fix in a PR.
All resources I found associate =
with escaped output and -
with raw unescaped output. Please see tj/ejs features, ejs.co docs and their implementation: Line 764 of ejs.js at GitHub.
In contrast, Lodash's implementation has things other way around, associating -
with escaped output and =
with raw output. Lodash might have taken a wrong step here. The _.templateSettings refer the default settings to follow Embedded Ruby and template literals of ES2015 but neither has a strong opinion on the matter. Embedded Ruby associates <%-
with slurping and ES2015 uses String.raw
prefix for unescaped template strings.
See also the default Lodash _.templateSettings. Maybe the property escape
has something to do with this? Maybe the default setting could be overridden in ejs-loader
?
@okonet For me this seems to be a Lodash issue. I went and opened an issue there.