Replies: 3 comments 18 replies
-
You could use my extension, https://github.com/pawamoy/copier-templates-extensions, particularly the Context Hook extension, to augment your context (in this case adding the |
Beta Was this translation helpful? Give feedback.
-
You can use a jinja macro. Macros can be defined in one file and then imported in others. And allow you to reuse partial templates. It would fit your use case exactly AFAICS. Example:
|
Beta Was this translation helpful? Give feedback.
-
If you want to avoid importing the macro definitions, you can define that pattern in a file and include it instead. |
Beta Was this translation helpful? Give feedback.
-
In my particular case I have the following copier.yml:
And in various parts of my .jinja files I do the following:
I want to define a variable in copier.yml that is the same as "questions":
And then use:
Can this be done in copier?
Beta Was this translation helpful? Give feedback.
All reactions