CSS Minification

We have our Cloudflare account set to Auto Minify CSS. However, many of our CSS files are not getting minified. Blank lines, white space, comments, etc are all still visible in the file.

I have even created a page rule for minifying these files, and getting the same result.

I have tried clearing the cache for these files, even clearing my cache, and they are not being minified.

The files have a .css file extension and are being served with the correct mime type from the server.

I have been reading some of the posts about minification and see Cloudflare may not optimize them as good as possible, but I am expecting something more than this…

1 Like

Can you post a link to such a CSS file?

Are those files getting any type of minification? It could just be a parsing error if they’re not compliant.


1 Like

Our custom theme file appears to minify after a few minutes…

Other theme files do not, ex:


As to why -> @cloonan maybe

1 Like

Its not quite clear to me why Cloudflare cant minify it. It does not seem to be the file itself, as I do get the file minified when served over a different domain.

On the other hand however it does not seem to be specific to the OP’s domain either as the other CSS file does get minified and there is no major difference in response headers. I briefly suspected the uppercase CSS could influence it, but https://homefurn.com/Themes/Brooklyn/Content/css/1280.css does not get minified either.


1 Like

For a bit I only received a miss for both the files, indicating it’s not cached so not minified; 1280.css was a miss consistently but now is a hit. More digging to do.

1 Like

So the files are not caching at Cloudflare?

Could there be a problem with the headers being sent from the origin server?

The file does appear to be cached by Cloudflare, however it seems they cant minify it for some other unknown reason.

Curious to see if maybe there was an error in the CSS in that file, I ran the CSS through the linter at http://csslint.net and only received a few warnings but no errors… hmm

As I mentioned, I got the same file minified by Cloudflare over a different domain.

You will probably have to wait until @cloonan has finished digging :slight_smile:

Hi @jphifer, I’m not turning up much of anything, different validators give different warnings, but no errors. One gave one warning, another over 20, which is when I suspected the large number of warnings was causing a parsing that @sdayman mentioned. But, as @sandro pointed out, it works on other domains.

I’d like to get other eyes on this for input. Can you login to Cloudflare and then open a ticket with Cloudflare Support. Support is very busy at the moment and it will take them some time, but it’s worth having them look at it. If you can, share the ticket number and I’ll get it into the right queue.

This topic was automatically closed after 30 days. New replies are no longer allowed.