I am getting this error in this file for a while now, and I can't understand the reason. I don't even have a semi-colon in this file
<section class="content">
<% switch(page){ %>
<% case : "userpage" %>
<div><%- include("all_users") %></div>
<% break %>
<% case : "postpage" %>
<div><%- include("all_posts") %></div>
<% break %>
<% default : %>
<div><%- include("card") %></div>
<% } %>
</section>
When page = "dashboard" it is going to include card.ejs file that too does not even have semi-colon.
What is it that I am doing wrong here?
My guess is that, the statement :
<% switch(page){ %>
is compiled as a seperate statement, and a ; is appended after it. Put it in the same bracket (<%) as the first case statement and it should work:
<% switch(page){
case : "userpage" %>
<div><%- include("all_users") %></div>
<% break;
case : "postpage" %>
<div><%- include("all_posts") %></div>
<% break;
default : %>
<div><%- include("card") %></div>
<% } %>