I've got django-compressor up and running, and have tested with COMPRESS_OFFLINE both on and off (both work). Now I am trying to use its CSS data-uri generation capability but am not having much luck. The otherwise excellent documentation doesn't say anything about how to configure or use it, other than to add the setting:
COMPRESS_CSS_FILTERS = [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.datauri.CssDataUriFilter'
]
If I then link to a stylesheet that includes something like:
p.imagetest {
background: url(/static/img/foo.jpg);
height: 100px;
}
and view source on that stylesheet, I expect to see the image represented as a data-uri, but I don't - it's still the normal path/to/file.
If I set COMPRESS_OFFLINE
to true and run manage.py compress
and inspect the generated file, same deal.
Is there an additional step required to get data-uris generated in stylesheets with django-compressor?
I think your problem may be referring to file size.
django.conf.settings.COMPRESS_DATA_URI_MAX_SIZE
Only files that are smaller than this in bytes value will be embedded.
By default COMPRESS_DATA_URI_MAX_SIZE
is set to 1024 bytes.
So you need to increase this value to allow the file to be encoded.