PlayForm / Compress

🗜️ Compress —
https://NPMJS.Org/@playform/compress
MIT License
479 stars 12 forks source link

CSSO silently removes nested CSS #368

Closed blopker closed 3 months ago

blopker commented 3 months ago

This was a weird one to track down because there was no error, just missing CSS rules in the output. It turns out CSSO doesn't support newer CSS features and just silently drops them: https://github.com/css/csso/issues/474. Lightningcss does the right thing. Since CSSO seems to be generally abandoned anyway, should it be dropped in favor of lightningcss?

blopker commented 3 months ago

For reference, the config to disable csso and just use lightningcss:

    playformCompress({
      CSS: { lightningcss: {}, csso: null },
    })
NikolaRHristov commented 3 months ago

csso provides structural optimizations which lightningcss doesn't.

blopker commented 3 months ago

Thanks for the reply! Is there a specific optimization you see that lightningcss doesn't do? I looked through all the documentation I could find and I don't see anything csso does better. When ran on my code, csso does make smaller css files, but that's only because it removes code it shouldn't be removing.

It looks like csso is just broken now and unlikely to get fixed. I don't understand why anyone would want to keep using it? Anyway, I've been able to disable it with the above config, so I'm all good.