Skip to content

pebreo/cookiecutter-hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overview / How it works

Cookiecutter is a command line utility that makes project templating easy. It works by taking variables from a JSON file full of variables and filling them into Jinja syntaxed variable names. The variables in the JSON can be for directory names, file names, and file contents.

You can use Cookiecutter from a local cookiecutter project (CP) or remotely from a github repo. But keep in mind that cookiecutter will copy the remote CP into your ~/.cookiecutters directory, so once you run cookiecutter on a remote repo, you only have to invoke the local copy.

So instead of doing this: cookiecutter [email protected]:myuserid/my-cp.git

You do this: cookiecutter ~/.cookiecutter/my-cp.git

How To Run

Step 1. Install cookiecutter::

$ pip install cookiecutter      

Step 2. Run cookiecutter::

$ cookiecutter https://github.com/pebreo/cookiecutter-hello-world.git

Gotchas

  1. When using cookiecutter from a git repo, your top directory (the same level as your cookiecutter.json) should be called {{cookiecutter.repo_name}}, otherwise you get an error.
UPDATE: This is not the case anymore with the newest cookiecutter. 
You can name your top directory whatever you want.
  1. In your cookiecutter.json, make sure your directory variables are defined first, then filenames, then file contents.

So given: {{cookiecutter.repo_name}}/{{cookiecutter.filename}}/{{cookiecutter.content}}

Your cookiecutter.json would look like:

{
    "repo_name": "myrepo",
    "filename": "myfile",
    "content": "mycontent"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published