Prevent empty lines in ejs for loops

Viewed 4998

I have the following simple ejs template:

<% for (var i =0; i < 10; ++i) { %>
    - <%- i %>
<% } %>

This renders the following:

- 0

- 1

- 2

- 3

- 4

- 5

- 6

- 7

- 8

- 9

How can I prevent ejs to create empty lines like these?

If possible I don't want to modify the result string but to tell ejs to not render these empty lines. How can I do that?

2 Answers
Related