I do not know if this is possible or not. Please give me an offer. My question is: how to add (enable) header.ejs inside the header block ejs-locals?
boilerplate.ejs
<!DOCTYPE html>
<html>
<head>
<title>It me</title>
<%-scripts%>
<%-stylesheets%>
</head>
<body>
<header>
<%-blocks.header%>
</header>
<section>
<%-body -%>
</section>
<footer>
<%-blocks.footer%>
</footer>
</body>
</html>
index.ejs
<% layout('boilerplate') -%>
<% script('foo.js') -%>
<% stylesheet('foo.css') -%>
<h1>I am the template</h1>
<p class="better-than-dead">I'm red if foo.css was loaded.</p>
<p>Here are some muppets we know about:</p>
<% block('header', "<p>I'm in the header.</p>") -%>
<% block('footer', "<p>I'm in the footer.</p>") -%>
header.ejs
<p>I'm in the header</p>
In the code above (index.ejs), you can see that the header block has HTML code. But I would like to include header.ejs.
Thanks.
source
share