cookiecutter:
conditionals and sets
Very often there is overlap between projects and you don't want to handle the boilerplate manually. In these cases cookiecutter can be an amazing tool that automates a lot of repetition away.
Notes
The 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 %}
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider signing up for the newsletter.