[Django]-Strange Issue When Minifying CSS via django-pipeline

6👍

The error isn’t entirely related to Pipeline but rather what Django’s CachedStaticFilesStorage that PipelineCachedStorage extends. The cached storage will look for file references in your css files and replace url('asset-link') and @import 'resource-link' with the appropriate link to the version with the md5 hash appended to it.

This will turn url('img/glyphicons-halflings.png') into url('img/glyphicons-halflings.<hash>.png'). So if you have asset references in your css files but don’t have the underlying assets, the post_process() of CachedStaticFilesStorage is going to throw that error.

You can read more here. I’d recommend to compile the less version of bootstrap with django pipeline and remove the less components that you don’t need, such as the icons if you don’t want to include the bootstrap icons. Or you can include the appropriate assets.

2👍

I’ve found the django-pipeline-forgiving package resolves this issue with the stock Django CachedStaticFilesStorage / PipelineCachedStorage very nicely

Leave a comment