Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using all of Tera's features (macros, includes, etc.) #75

Open
TECHNOFAB11 opened this issue Dec 18, 2024 · 1 comment
Open

Allow using all of Tera's features (macros, includes, etc.) #75

TECHNOFAB11 opened this issue Dec 18, 2024 · 1 comment

Comments

@TECHNOFAB11
Copy link

When having a single repo with multiple templates for example it would be cool to have access to all the advanced features of Tera, like macros, blocks, includes etc.

Currently everything is rendered using one_off, thus no includes etc. work.
It might be possible to just pass the root path of the repo to Tera, not sure what the performance implications are when the repo is quite big (if Tera loads these files no matter what it would be hell, but if they're only loaded on demand anyways it should be fine).
That way something like that would be possible:

|- templates
|   |- <templatename>
|   |   |- flake.nix
|   |   |- template.toml
|- utils/shared/common whatever
|   |- flake.nix

And then be able to {% extend "utils/flake.nix" %} in templates/<name>/flake.nix. This way files and contents which are shared across templates could be pulled out to a single path, making maintenance easier :)

Repos containing just a single template could benefit from this aswell, as these features could still be used (the imported files just have to be added to ignore so they're just used by Tera)

@Keats
Copy link
Owner

Keats commented Dec 20, 2024

I'm not too sure about that, since it becomes tricky to see the difference between the template files and the files used just to generate the templates. I'll need to think about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants