Gulp CSS minify & gzip + django-compressor not working
I am trying to minify and compress my css (and later js) and serve it up. To do this, I first minify and compress it with gulp and then serve the gzipped files with django-compressor (this will only make an HTTP request).
I pretty much followed this tutorial: http://www.revsys.com/blog/2014/oct/21/ultimate-front-end-development-setup/
Using gzipped files directly works well, however, when I try to group them with django-compressor, I get the following error:
UncompressableFileError at /
UnicodeDecodeError while processing '..../static/mincss/filename.min.css.gz'
with charset utf-8-sig: 'utf8' codec
can't decode byte 0x8b in position 1: invalid start byte
Which matches the compress on tag:
{% compress css %}
<link rel="stylesheet" href="{{ STATIC_URL }}mincss/filename.min.css.gz">
...more files
{% endcompress %}
I'm 99% sure the generated gzipped files are correct. They are us-ascii (a subset of utf-8) and they contain a * .min.css file.
My respective settings (which I know) for the problem are the same as those given in the manual. The only difference is that in the manual it includes css files like this:
{% compress css %}
<link rel="stylesheet" href="{% static "stylesheets/main.css" %}" />
<link rel="stylesheet" href="{% static "stylesheets/some-other.css" %}" />
{% endcompress %}
But this way (although it works) doesn't use gzipped files, not even minified ones. What am I missing?
source to share
The attached file must not contain the gzipped extension. Just providing a filename (* .css) to the compressor will automatically check for and download the gzipped version of the file (must have the same name plus .gz).
Remember that it will only download compressed files on production (with support for debug = false and offline compression)
source to share