CssMinifyFormatter Class
Writes a minified CSS text: the whitespace that is not needed is removed, as well as the semicolon of the last declaration of a block. The style sheet is not modified.
public sealed class CssMinifyFormatter : CssFormatterRemarks
The values of the custom properties are written as is: they are token sequences whose text can be read by scripts. The values that contain a substitution function, such as var(), are kept as specified too: only their whitespace is removed, their numbers and colors are not shortened.
- Inheritance
CssFormatterCssMinifyFormatter
Constructors
| Name | Description |
|---|---|
| CssMinifyFormatter() |
CssMinifyFormatter()
CssMinifyFormatter.cspublic CssMinifyFormatter()No documentation is available.
Properties
| Name | Description |
|---|---|
| RemoveEmptyRules | Whether the rules that have no effect are removed: the style rules without declarations (and whose nested rules are removed), and the @media, @supports, @container, @scope and @starting-style rules whose child rules are removed. The empty @layer and @keyframes rules are kept: they declare a layer or replace the keyframes of the same name. The default is true. |
| RemoveLeadingZeros | Whether the leading zero of the numbers of the values is removed (0.5s is written .5s). The default is true. |
| ShortenColors | Whether the opaque rgb() colors whose components are integers are written in their hexadecimal notation (rgb(255, 0, 0) is written #f00). The default is true. |
RemoveEmptyRules
CssMinifyFormatter.csWhether the rules that have no effect are removed: the style rules without declarations (and whose nested rules are removed), and the @media, @supports, @container, @scope and @starting-style rules whose child rules are removed. The empty @layer and @keyframes rules are kept: they declare a layer or replace the keyframes of the same name. The default is true.
public bool RemoveEmptyRules { get; init; }