I'm using <% include components/aside.ejs %> or <% include components/head.ejs %> somewhere in my code without any problem. But when I use include in a for loop like this
<%
for (var i = 0; i < 20; i++) {
    include components/head.ejs;
}
%>
, I get Unexpected identifier in [file path] while compiling ejs.
Is there any obvious mistake that I'm not noticing?
To fix a breaking change, as of EJS 3.x, the syntax for an include has gone from <%- include components/head.ejs %> to <%- include('components/head.ejs'); %>.
You can try this one.
    <% for (var i = 0; i < 20; i++){ %>
     <%- include('component/footer') %>
    <% }; %>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With