Open MarkTraceur opened 11 years ago
include is compile-time
Because the include has to be loaded synchronously, it must be loaded at compile time, which means that the value of tplBody is unknown. QEJS supports async rendering of partials (so it doesn't have to happen at compile time) and is otherwise almost identical to EJS. Alternatively I suggest you watch #69
we dont even really need async partials, it's more efficient to cache anyway so a single initial sync hit doesn't matter much
Hello,
sorry to bother, but i'm facing the same problem that MarkTraceur mentioned. An asynchronous include would be really helpful in this case (layout + dynamic partial rendering).
Is it a feature in development or is there a way to write my own function ?
<% include head %>
doesn't seem to work with node-email-templates https://github.com/niftylettuce/node-email-templates
I'm working on it, I've just been a bit busier than expected over the last few weeks. See: #69
Hi!
I'm using the include keyword in a base template to include whatever template I want to be on the page. It looks like so:
Sadly, because the include keyword assumes that whatever happens after it is a string, not a variable, I get
Clearly this is wrong. Inside of the <% %> block, there shouldn't be fudging of the JS syntax. Besides that, there should be a way to include arbitrary templates inside of others.
I would also settle for a way to extend templates, like in the Jinja2 system of Python fame. But that seems like a lot more work.
Cheers!