'Minify CSS' removes unit from 0 values

Hey there, on my site (fortomorrow.eu) we use CSS min() and max() functions. It took me a while of debugging, but it looks like the ‘Minify CSS’ post-processing option removes units from 0 values. This is a problem for styles like:

min(-660px + 40vw,0px);

That become:

min(-660px + 40vw,0);

Which is not understood by Firefox and Chrome (and perhaps other browsers).

I disabled the option for now and that seems to have fixed it. But I wonder, is there any way to get around that? Or is this a bug in the minification algorithm?

I think these CSS functions were release at the end of 2019 (or at least that’s when major browsers added support for it), however our minification tool was built before that, but likely not updated.

I can confirm, browsers do need the unit in these functions and to me, this sounds more like a browser issue (not completely, but in some sense), because in almost everything else, 0 is supported without a unit. But I guess, there’s probably a reason for that.

I’ll file an internal bug for this, though I’m not sure if/when this would be fixed.

1 Like