You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect the rendered HTML to look exactly the same no matter the value of the rmWhitespace option. However, when EJS code is structured in certain ways, rmWhitespace causes the rendered HTML to be structured differently.
view.ejs
<h2><%- 'EJS' %>
Title
</h2><h2>
HTML
Title
</h2><div><span>1</span><span>2</span><span>3</span></div>
This highlights the problem of giving EJS the responsibility for (re-)formatting the output. And I think we've made things worse by providing multiple ways to do it now. Ultimately we should probably have the basic slurp, and then provide some sort of user-settable filter property that people can plug into to format the final output however they want.
I would expect the rendered HTML to look exactly the same no matter the value of the
rmWhitespace
option. However, when EJS code is structured in certain ways,rmWhitespace
causes the rendered HTML to be structured differently.view.ejs
index.js
Output with
rmWhitespace: false
Output with
rmWhitespace: true
Notice how
rmWhitespace: true
removes all whitespace (including newlines) betweenEJS
andTitle
as well as<span>2</span>
and<span>3</span>
.This happens with both LF and CRLF line endings.
The EJS code that seems to cause this to happen is:
<%- %>
and<%= %>
The text was updated successfully, but these errors were encountered: