Closed ws1088 closed 3 years ago
{% set testing = 'it worked' %}
You can find everything in Jinja2 docs :) https://jinja.palletsprojects.com/en/2.11.x/
Wondering if you could elaborate here just a little bit? I'm new to this jinja2 stuff and it's still something of a mystery. I read through some of the docs and tried a couple of things based on your comment above, but couldn't get anything to work.
In pre_gen_project.py
:
{% set testing = 'it worked' %}
{{ cookiecutter.update({"test": "{{ testing }}"}) }}
Then, in a file that's being rendered:
{{ cookiecutter.test }}
But the rendered file contains:
"{{ testing }}"
I get a syntax error if I instead try and do the update() call like this:
{{ cookiecutter.update({"test": {{ testing }}}) }}
The error:
jinja2.exceptions.TemplateSyntaxError: expected token ':', got '}'
Thanks, Lance
The following doesn't seems to work in
pre_gen_project.py
Is it possible?