Remove query string from inline css

I use the django compressor for my small site, and I do not want the query strings to appear on the images. e.g. Images /header.png? 9e1ed2cd7d15

Is there any way to disable it?

+4
source share
2 answers

Django Compressor allows you to control CSS compression by selecting from a set of filters that will be applied using the django.conf.settings.COMPRESS_CSS_FILTERS parameter.

Note that the default filter, CssAbsoluteFilter, normalizes the URLs used in CSS url () statements and adds a hash to the URLs being processed. You can control the hash type generated by the django.conf.settings.COMPRESS_CSS_HASHING_METHOD parameter.

According to the documentation, your only choice for a hash method is "mtime" or "content", but there seems to have been a commit committed two weeks ago that added None support as an option. Theoretically, if you install the latest version from GitHub and set this parameter to None, this should get rid of these query strings.

Otherwise, you can always try to completely remove CssAbsoluteFilter.

+6
source

A clean installation through pip install django_compressor ( in more detail here ) should work fine, as for me. This is only a css hash file, use this code to compress:

 {% compress css %} <link href="yourstyle.css" rel="stylesheet"> {% endcompress %} 
0
source

All Articles