Support multiple template dirs
I would love to have support for multiple template dirs to solve relative imports. Something on the line to what is suggested here https://stackoverflow.com/questions/2180247/does-the-jinja2-templating-language-have-the-concept-of-here-current-director
Can you please give me an example of how would you like j2 to behave? Are you talking about the inclusion of other template files from the one that you pass as an argument?
@kmpm bump? :)
I believe @kmpm is referring to the ability to add
{% include "some-template.j2" %}
and have j2cli search a set of paths to locate a template with that name.
For example, https://stackoverflow.com/questions/35802741/jinja-cant-find-template-path
I've run into this issue as well. It's not clear where the {% include ... %} directive will search for templates. I've created a folder
/templates/mytemplate.j2 /templates/common.j2
and tried to include common.j2 into mytemplate.j2 but generate a jinja2.exceptions.TemplateNotFound exception.
It would be nice to use {% extends "base.j2" %} and {% include "favorite/macros.j2" %}
And it seems possible using absolue paths if templates are in other directory: https://github.com/kolypto/j2cli/blob/master/j2cli/cli.py#L28
Exactly as @luchaninov describes. To be able to extend and include without absolute paths is a minimum. Some kind of "by convention" or configurable search paths would be nice.