timonweb / django-tailwind

Django + Tailwind CSS = 💚
https://django-tailwind.readthedocs.io
MIT License
1.45k stars 89 forks source link

Cache Busting #108

Closed lukeoiler closed 2 years ago

lukeoiler commented 2 years ago

Hi,

I was wondering if there would be a good way to get around cache-busting in an automatic fashion. Because the Stylesheet-Name is generally static, if there are changes, the client will only see them once the caching is gone. I tried to integrate Post-CSS hash or Cache-Busting but couldn't make it work. Is there a way around it or a way to integrate it?

Best, Lukas

timonweb commented 2 years ago

The simplest approach is to use v= parameter: https://django-tailwind.readthedocs.io/en/latest/templatetags.html#asset-versioning

Alternatively, you could wrap your stylesheet link with {% compress css %} tag from https://django-compressor.readthedocs.io/en/stable/, it'll do versioning automatically.

lukeoiler commented 2 years ago

Yea I tried django-compressor, but somehow I had some issues on chrome then where it wouldn't show the ring effect. Might be some installation issue on my side. But I completly missed the versioning, thank you so much for the quick help! That already gives me a working start, while I try to fix the compressor issue.

Thanks also again for this awesome repository!