Closed exequiel09 closed 3 years ago
I don't think so. However, you can instantiate point-of-view in separate plugins. So you can have different part of the application using different point-of-view configuration.
Anyway, would you like to send a PR?
Editing the title since it causes confusion. The thing is you wont get to access the top-most templates dir which you can use to place the base template and extend it from the other modules.
I don't think so. However, you can instantiate point-of-view in separate plugins. So you can have different part of the application using different point-of-view configuration.
This would require a lot of refactoring since templatesDir
requires only string and other templating engines have a different mechanism on how inheritance in template works. The above structure is somewhat similar to Flask Blueprints in Python.
This type of template inheritance in Flask is feasible with nunjucks
(correct me if i'm wrong in other templating engines) since it was entirely inspired by Python's jinja2
package.
This table shows the templating engines currently supported alongside with their support for template inheritance and template inclusion. (This list is just based on my research and may contain errors)
Template Engine | Template Inheritance | Template Inclusion |
---|---|---|
ejs |
No | Yes |
ejs-mate |
Yes | Yes |
nunjucks |
Yes | Yes |
pug |
Yes | Yes |
handlebars |
No | Yes |
marko |
No | Yes |
This would be a very useful feature. Would you like to file a PR with this?
Sorry @mcollina i was busy this past few days. I can't as of the moment so many tasks to do. Will just leave it here open so anyone can look it into it. If i have time i'll just bring it up here that i have filed a PR.
Working on a PR for Mustache which supports template inclusion ("partials" in mustache-land) and am considering how best to handle this. I have a proposal and a question:
viewEngineName(pagePath, data)
except for Marko and now Mustache which both are viewEngineName(pagePath, data, options)
. The only available property on Marko options (currently) is stream
and the only one on Mustache is partials
. I propose that these two properties be the starting point for defining a common, optional options
parameter that is the same for all engines. Not all engines will support all the properties of course but it will give us a common API.I'm +1 for both proposals.
Did mustache support solved this issue?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is multiple templates directory like the one below supported? Since some of the template engines supported allows extension of templates (template inheritance) from other templates (e.g.
nunjucks
).