Closed kokujin closed 5 years ago
Hi @kokujin, thanks for the questions! There's no default way for templates to inherit from a layout template, but it would be relatively easy to implement using helpers. Here's how a template could look after you registered two helpers:
{{use('somelayout')}}
{{#header}}
This will get put in the header section
{{#content}}
This will get put in the content section
{{/use}}
Then, your layout could look like this:
<html>
<head>
{{header}}
</head>
<body>
{{content}}
</body>
</html>
And the use
helper could just render the layout template with the values of its blocks. That probably makes almost no sense 😄 so I'll create an example soon and share it with you.
I did mention giving up in that thread, but since then I have realized that Squirrelly has a lot of unique advantages. Plenty of people use Handlebars and Mustache for their simplicity, but Squirrelly is faster and more lightweight while being (I think) just as simple.
I think the real value of Squirrelly is in its simplicity and speed. As shown in this benchmark, it's one of the fastest template engines out there. However, it contains much less bloat than many other template engines I've seen; it gives you the tools and allows you to build on them.
I hope this helps! As I said, I'll put together an example project using layouts and inheritance soon 😃
Happy holidays and thanks @nebrelbug.
You mentioned giving up on this thread, https://github.com/dondido/express-es6-template-engine/issues/11#issuecomment-388581032. Is this still the case?
Thanks