[Question] How to trim whitespaces and indentation?
Closed this issue · 2 comments
tjhoo commented
Hi
I have a template (with indentation) that looks like the following,
<html>
<body>
<h2 ><%= it.name %></h2>
</body>
</html>
Can Eta
trim all the indentation and EOL when generating the output? I want the indentation when editing the template, and to trim the whitespace when saving the output into database.
I have enabled autoTrim
like this,
const eta = new Eta({ views: "templates", autoTrim: ["nl", "slurp"] });
const html = eta.render("./dummy", data);
but the indentation and whitespaces are still in html
.
nebrelbug commented
@tjhoo Eta won't minify your HTML for you, autoTrim
just enables trimming after Eta tags. But you could write a plugin to perform minification quite easily!
tjhoo commented
Thanks for your reply.