21π
Did you try django-compress ?
See http://djangopackages.com/grids/g/asset-managers/ for a fairly complete list of available asset managers for Djangoβ¦
If you already are using django-compress, you should have a look at upgrading to django-pipeline, which is a well maintained fork, with a lot of new features. I encourage everyone to who is using django-compress to switch to django-pipeline instead: * django-pipeline documentation
18π
Django-compress is no longer being maintained. Try https://github.com/cyberdelia/django-pipeline instead.
- [Django]-Django REST Framework and FileField absolute url
- [Django]-URL-parameters and logic in Django class-based views (TemplateView)
- [Django]-Django default=timezone.now + delta
8π
Iβve been using webassets and so far Iβm very satisfied. What I really like about it, is that youβre still able to define your CSS and JS files inside of your templates, instead of in the project configuration.
Documentation can be found at: http://elsdoerfer.name/docs/webassets/
- [Django]-Django: ImproperlyConfigured: The SECRET_KEY setting must not be empty
- [Django]-Django: Difference between BASE_DIR and PROJECT_ROOT?
- [Django]-Django: remove a filter condition from a queryset
4π
As of the end of 2016, these answers are mostly outdated.
Check here for a few options:
https://gitlab.com/rosarior/awesome-django#asset-management
At the moment, django-compressor is a good choice, but there are alternatives depending on what you want to do. I believe webpack is becoming popular these days as well.
- [Django]-How to make email field unique in model User from contrib.auth in Django
- [Django]-How to get GET request values in Django?
- [Django]-How does Django Know the Order to Render Form Fields?
0π
I wrote this Makefile to minify and concatenate my JS and CSS files. It depends on the YUI Compressor JAR.
After updating a file, you still have to run make
though. Nevertheless, you can make it run when the server starts and/or reloads, or setup a commit-hook on your SCM.
Of course you still need the {% if not debug %}
, but itβs a small price to pay IMO.
Showing the simple usage:
$ make
[css] static/css/first.css
[css] static/css/second.css
[css] static/css/third.css
[css] static/css/and_so_on.css
[tag] @import url("static/css/all.css");
[js] static/js/first.js
[js] static/js/second.js
[js] static/js/third.js
[js] static/js/and_so_on.js
[tag] <script type="text/javascript" src="static/js/all.js"></script>
Done.
- [Django]-Django storages: Import Error β no module named storages
- [Django]-Django: create Index: non-unique, multiple column
- [Django]-Sending post data from angularjs to django as JSON and not as raw content
-1π
Just released an open-source project that watches directories for changes and auto-minifies JS, auto-compiles SASS/SCSS, runs command line operations, etc.
Check it out at http://devWatchr.com/
It runs using python
and pyinotify
on your system during development.
- [Django]-Can "list_display" in a Django ModelAdmin display attributes of ForeignKey fields?
- [Django]-How can I iterate over ManyToManyField?
- [Django]-Django β Site matching query does not exist