Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript & CSS Obfuscation/Minimization in Django Website?

I am serving CSS and javascripts in my django website, so how to obfuscate and minimize them. 1 solution is: To serve already obfuscated and minimized js and css.

can I have a flag set in settings.py that to switch on and off the obfuscation?

So, that I can develop on normal human readable code and serve the obfuscated css and js.

What is the standard method of achieving this?

like image 380
Yugal Jindle Avatar asked Mar 02 '26 22:03

Yugal Jindle


1 Answers

I would recommend django-compressor. It supports running your JS/CSS through a number of different compression algorithms (JSMin, Slim It, YUI, Closure Compiler).

like image 142
Mark Lavin Avatar answered Mar 04 '26 12:03

Mark Lavin