Simplest option to minify CSS/JS files?

Hello,

I am curious what other Djangonauts use for static files (CSS/JS) minification. I know there are some libraries but I was wondering if there is simpler solution available?

I am already using this wonder thing STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' so perhaps there is something that also adds minification of the files?

I have tried looking into the ManifestStaticFilesStorage source to see if I maybe add some basic minification myself, but it looked a bit daunting :smiley:

Thanks!

I’ve plugged some nodejs/gulp (git ignoring the horrendously large modules folder, obviously) and it has worked quite well for me so far.
The gulp file can easily be made ot write wherever you want, so it looks as simple as (can even be made into a callable shell/alias):

$ (env) gulp css # writes aggregate css to your STATICFILES_DIRS settings
$ (env) python manage.py collectstatic # lsyncd listening to files landing as a result of this for the actual push/sync to wherever..

I honestly do not know if that is considered best practice, but it is easy, clean and keep absolute control over your pipeline while keeping on using a lot of the django “standard tools”.