You can also run logic inside of variable definitions to make your life
easy. Let's consider this contents of the cookiecutter.json
file;
{
"project": "project",
"author": "author",
"project_slug": "{{cookiecutter.project.lower().replace(' ', '_')}}",
"license": ["MIT", "BSD"]
}
The contents of the readme.md
file;
# readme of {{cookiecutter.project}}
This package was made by {{cookiecutter.author}}.
{%- if cookiecutter.license == "MIT" -%}
This is an MIT license.
{%- elif cookiecutter.license == "BSD" -%}
This is a BSD license.
{% endif %}