mozilla / nunjucks

A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)
https://mozilla.github.io/nunjucks/
BSD 2-Clause "Simplified" License
8.48k stars 635 forks source link

Template loader with contextual info #1411

Open dcarniel opened 1 year ago

dcarniel commented 1 year ago

Hello,

I'm using nunjucks with a set of templates which have "variants" for multiple channels (email, HTML page, PDF...), the idea being to render the same "content" with templates that adapt the content to the channel.

I've implemented this by storing templates in a database with the different "variants" and manually building the inheritance. It works fine but forces me to provide a custom UI to edit templates.

I would like to use files so templates can be edited through a generic text editor (like VS Code) and stored on a Filesystem. I though I could use a naming convention such as