New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hooks don't have access to the original template directory #706
Comments
Closed
+1 |
simobasso
added a commit
to simobasso/cookiecutter
that referenced
this issue
Jan 2, 2021
implement a templates directory so a maintainer can use `extends`, `includes`, `blocks`, `import` and `super` inside the cookiecutter project template using jinja directly. docs: https://jinja.palletsprojects.com/en/2.11.x/templates/#template-inheritance closes: cookiecutter#1484 ref: cookiecutter#706 ref: cookiecutter#59 ref: cookiecutter#1004
simobasso
added a commit
to simobasso/cookiecutter
that referenced
this issue
Jan 2, 2021
implement a templates directory so a maintainer can use `extends`, `includes`, `blocks`, `import` and `super` inside the cookiecutter project template using jinja directly. docs: https://jinja.palletsprojects.com/en/2.11.x/templates/#template-inheritance closes: cookiecutter#1484 ref: cookiecutter#706 ref: cookiecutter#59 ref: cookiecutter#1004
abvikg
pushed a commit
to Over-haul/cookiecutter
that referenced
this issue
Jul 16, 2021
implement a templates directory so a maintainer can use `extends`, `includes`, `blocks`, `import` and `super` inside the cookiecutter project template using jinja directly. docs: https://jinja.palletsprojects.com/en/2.11.x/templates/#template-inheritance closes: cookiecutter#1484 ref: cookiecutter#706 ref: cookiecutter#59 ref: cookiecutter#1004
insspb
pushed a commit
to simobasso/cookiecutter
that referenced
this issue
Jun 6, 2022
implement a templates directory so a maintainer can use `extends`, `includes`, `blocks`, `import` and `super` inside the cookiecutter project template using jinja directly. docs: https://jinja.palletsprojects.com/en/2.11.x/templates/#template-inheritance closes: cookiecutter#1484 ref: cookiecutter#706 ref: cookiecutter#59 ref: cookiecutter#1004
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to include a configuration summary with the generated projects. The summary would be a JSON file, dumped by
post_gen_project
hook, which would include the cookiecutter context that was used to create the project (same as the files used by--replay
functionality).But I'd also like the config summary to include the revision (commit hash) of the used cookiecutter template. This is useful for enabling easy upgrading of the used template, i.e. incorporating the template changes into a project that had been generated from an older version of the template.
Problem is that ATM hooks don't seem to have any way of accessing the template source dir (correct me if I'm wrong). I'd propose to modify
generate_files()
to add some special keys to the context, including (but perhaps not limited to) the original template directory. The new values could either go into a new toplevel dict in the context (next to thecookiecutter
dict), or maybe into the existingcookiecutter
object, prefixed with underscores.Let me know if this is something that would fit into cookiecutter. If yes and we agree on the implementation, I should be able to create a PR.
The text was updated successfully, but these errors were encountered: