1๐
โ
I use django_assets for this. For my CSS and SASS files, I use an assets.py
file that looks like this:
css_bundle = Bundle(
'scss/main.scss',
depends=('scss/**/*.scss',),
filters='pyscss,cssmin',
output='compiled/main.min.css'
)
register('css_bundle', css_bundle)
Which I can then include in my templates like this:
{% assets "css_bundle" %}
<link rel="stylesheet" href="{{ ASSET_URL }}"/>
{% endassets %}
Cache busting is built right in, and you can do something similar for JS files.
๐ค2ps
Source:stackexchange.com