The stylesheet is scanned rather than run through a set of blanket replacements, which matters because a stylesheet contains strings. Text inside quotes, and inside url(), is set aside before anything is collapsed and restored afterwards, so a comment sequence written inside a content value stays as it was and the spacing inside a quoted string is untouched.
Comments are removed, whitespace outside strings is collapsed, and the space around the structural punctuation — braces, semicolons, commas and the colon in a declaration — is dropped along with the final semicolon in each block. Comments beginning with an exclamation mark are kept, since that is the convention for a licence header.
What is deliberately left alone
-
calc() operators keep their spaces:
the arithmetic operators need whitespace to parse, and calc(100% - 20px) stops working the moment it goes. Nothing around a plus or minus sign is touched.
-
Nothing is reordered or merged:
duplicate rules stay duplicated, shorthand is not condensed and properties are not sorted. Those transformations are what a full processor does, and each carries a risk this does not take.
-
url() contents are preserved:
an unquoted URL can contain characters that would otherwise look like structure, so it is set aside whole.
-
The saving is modest and safe:
expect the size of the comments and the indentation. A build pipeline with a real CSS processor will do better, and this is for a file that has none.
Why a stylesheet gets scanned rather than blanket-replaced
A stylesheet contains strings, and a minifier that does not know that will happily collapse whitespace sitting inside a quoted value or a `url()`. The [msm_tool slug="css-minifier"] sets both aside before anything is touched and restores them afterwards, so a comment-like sequence written inside a `content` value stays exactly as written rather than being misread as a real comment.
calc() keeps every one of its spaces
The arithmetic operators inside `calc()` need surrounding whitespace to parse at all — `calc(100% - 20px)` stops working the instant those spaces disappear. Nothing around a plus or minus sign inside a `calc()` expression is touched, specifically because that particular whitespace is not decorative.
Nothing is reordered, merged or condensed
Duplicate rules stay duplicated, shorthand properties are not combined, and declarations are not sorted or restructured in any way. Those transformations are what a full CSS processor does, and each one carries a risk of changing what the stylesheet actually means — a risk this tool deliberately does not take on.
url() contents come through whole
An unquoted URL can contain characters that would otherwise look like structural punctuation to a naive scanner, so the entire `url()` value is set aside and restored untouched rather than being parsed as ordinary CSS text.
Licence comments survive on purpose
A comment starting with an exclamation mark is kept rather than stripped, following the same convention used for licence headers elsewhere — every other comment is removed, but this specific exception is deliberate rather than an oversight.
What kind of saving to actually expect
The reduction here is roughly the size of the comments and the indentation that were removed, not the deeper savings a dedicated build-time CSS processor achieves through restructuring. For a file with no processing pipeline behind it, that modest, safe reduction is the entire point.