cookiecutter-django
cookiecutter-django copied to clipboard
Linter/Formatter for Django templates
Description
I propose we add either djlint or djhtml as a local requirement and pre-commit hooks.
Rationale
I think this is a missing part of the tooling available for the cookiecutter-django ecosystem. What do you think?
These 2 look really good! Thanks for the suggestion.
I'm not sure which one is better though. Here what I could gather:
- Looks like they were started around the same time
- Both seem quite active and well maintained.
djhtmlseems a bit more focused on Django, whiledjlintseems a bit more general purpose (supporting other template languages like handlebars).djhtmlhas more than double the amount of GitHub stars. That might be just down the lead maintainer being better at marketing, though.
I don't see a clear winner from the above, so I guess it would be down to trying each and see which one behaves better. One aspect I'm interested in is how fast they run on a relatively large project, autoformatter can be slow and when you need to run on each commit, execution time matters. Do you have some insights to provide on that front?
Thanks for considering it!
From my experience I have only been using djlint with neovim, mostly working 'on demand' basis. I recently started to also include it in a pre-commit workflow, and so far its been just fine (project not as big though).
One thing to notice is that although they have some overlapping functionalities, djlint claims to be a linter/formatter while djhtml an indenter.
Hi, I am just starting to contribute to open source and I think this can be a good issue for me. Can I take it? Looks like djlint will be used here and not djhtml
@sikaili99, how can I help support you in adding this? I'm new(er) to cookie-cutter, but if @aleprovencio or @browniebroke can point to the file(s) and process, I could write code this week and next with @sikaili99.
I'm guessing its more than adding 'djlint' or 'djhtml' to line 12 below in the code quality section of requirements.txt
djlint or djhtml as a local requirement and pre-commit hooks
@datatalking I haven't looked into this much, but I think after adding the package on line 12, there should be adding some configurations in the pre-commit config file!
that's correct, in addiction it might be a good idea to format/lint all template files so users won't get errors on a new project.