A script which formats py4web templates using DJLint, by partially converting them to Django syntax and back.
How to use:
- Install DJLint:
py -m pip install djlint
- Download the script
- Run the script with a template file:
py template_formatter.py ./templates/mytemplate.html
Auto-format on save in VSCode:
- Get the Run On Save extension
- If you have a venv, configure it like this. (assumes venv is located in:
./.venv
- if its not, or on another OS, adjust paths accordingly.)