Automatic formatting of Django templates

I found that you can use comments to have prettier ignore your tags

My observations:

I was so desperate that I wanted to write a prettier plugin, but luckily I have found a working one (with exactly zero stars) - GitHub - sezze/prettier-plugin-django-alpine: Format Django tags and Alpine.js in HTML files.

For VSCode it requires extension & local installation of prettier - you may need to use "prettier.prettierPath": "./node_modules/prettier/index.cjs" in your settings.json (as newbie I am not allowed to add the 3rd link to this post).


I use TailwindCSS and need sorting of class names - it would be nice if it is done by prettier to. But the official plugin prettier-plugin-tailwindcss is crazy and whitelists (actually embeds) compatible (presumably popular) plugins. So I made a fork and now I can have support for it all: GitHub - brablc/prettier-plugin-tailwindcss-django-alpine: A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order. .