#4305·grav

CSS minifier breaks on modern CSS: `calc()` spacing and `hsl(h s% l%)`

Author: onetrevCreated Sep 14, 2026Updated Sep 16, 2026

Hi Andy,

Grav 2.1.2's CSS pipeline minifies through tubalmartin/cssmin 4.1.1 (Assets/Pipeline.php), whose last commit is from January 2018. Two things it does to current CSS:

  • It strips the spaces around + and - inside calc(), which browsers then discard as invalid, so the rule silently disappears.
  • It throws on space-separated colour syntax such as hsl(210 40% 50%).

The pipeline has no per-file isolation, so one throw 500s every page. Same family as #3095 (2020), whose answer was to keep the file out of the pipeline.

Ask: a maintained minifier, or failing that, catch a minifier throw and pass that one asset through unminified. Until then assets.css_minify: false costs about 2 KB a page.

Cheers, Trev