One-click templating

Using Jinja and Cookiecutter to instantly create documents in your company's style and configuration.

How can we both source control a document template on Git, yet make it available to copy? I have found that users would resort to forking or cloning the template, then manually adjusting the pre-existing template configuration to create a new document. This process proved cumbersome, not intuitive, and not the intended usage of forking or cloning.

Using Cookiecutter allows us to duplicate any repository and pass command-line variables into the generated folder's files using Jinja templating.

This means we can essentially copy/paste a source controlled template folder, yet not inherit any Git history or other configuration setups.

We now have a scalable, easy, and instant solution for users to create a document locally using a company's styling and configuration.

Example

Jinja variables in the Sphinx configuration file:

# -- Project variables -------------------------------------------------------

project = '{{ cookiecutter.project_name }}'
gitlab_ref = '{{ cookiecutter.gitlab_ref }}'
version = '{{ cookiecutter.version }}'
default_branch = '{{ cookiecutter.default_branch }}'

To setup a document:

cookiecutter git@gitlab.com/path/to/template.git

See also

Cookiecutter