DOKK / manpages / debian 12 / cleancss / cleancss.1.en
CLEANCSS(1) User Commands CLEANCSS(1)

cleancss - cleancss - fast and efficient CSS optimizer

cleancss [options] <source-file ...>

output the version number
Force compatibility mode (see Readme for advanced examples)
Shows debug information (minification time & compression efficiency)
Controls output formatting, see examples below
Use [output-file] as output instead of STDOUT
Turn on level <n> optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below
Enables inlining for listed sources (defaults to `local`)
Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)
Remove files inlined in <source-file ...> or via `@import` statements
Disable URLs rebasing
Enables building input's source map
Enables inlining sources inside source maps
Specifies the path of the input source map file
output usage information

%> cleancss one.css
%> cleancss -o one-min.css one.css
%> cleancss -o merged-and-minified.css one.css two.css three.css
%> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz

%> cleancss --format beautify one.css
%> cleancss --format keep-breaks one.css
%> cleancss --format 'indentBy:1;indentWith:tab' one.css
%> cleancss --format 'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on' one.css
%> # `breaks` controls where to insert breaks
%> # `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`)
%> # `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`
%> # `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`
%> # `afterComment` controls if a line break comes after a comment; defaults to `off`
%> # `afterProperty` controls if a line break comes after a property; defaults to `off`
%> # `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`
%> # `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`
%> # `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`
%> # `betweenSelectors` controls if a line break comes between selectors; defaults to `off`
%> # `indentBy` controls number of characters to indent with; defaults to `0`
%> # `indentWith` controls a character to indent with, can be `space` or `tab`; defaults to `space`
%> # `spaces` controls where to insert spaces
%> # `aroundSelectorRelation` controls if spaces come around selector relations; e.g. `div > a`; defaults to `off`
%> # `beforeBlockBegins` controls if a space comes before a block begins; e.g. `.block {`; defaults to `off`
%> # `beforeValue` controls if a space comes before a value; e.g. `width: 1rem`; defaults to `off`
%> # `wrapAt` controls maximum line length; defaults to `off`

%> cleancss -O0 one.css

%> cleancss -O1 one.css
%> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css
%> cleancss -O1 all:off;specialComments:1 one.css
%> # `cleanupCharsets` controls `@charset` moving to the front of a stylesheet; defaults to `on`
%> # `normalizeUrls` controls URL normalzation; default to `on`
%> # `optimizeBackground` controls `background` property optimizatons; defaults to `on`
%> # `optimizeBorderRadius` controls `border-radius` property optimizatons; defaults to `on`
%> # `optimizeFilter` controls `filter` property optimizatons; defaults to `on`
%> # `optimizeFontWeight` controls `font-weight` property optimizatons; defaults to `on`
%> # `optimizeOutline` controls `outline` property optimizatons; defaults to `on`
%> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)
%> # `removeNegativePaddings` controls removing negative paddings; defaults to `on`
%> # `removeQuotes` controls removing quotes when unnecessary; defaults to `on`
%> # `removeWhitespace` controls removing unused whitespace; defaults to `on`
%> # `replaceMultipleZeros` contols removing redundant zeros; defaults to `on`
%> # `replaceTimeUnits` controls replacing time units with shorter values; defaults to `on
%> # `replaceZeroUnits` controls replacing zero values with units; defaults to `on`
%> # `roundingPrecision` rounds pixel values to `N` decimal places; `off` disables rounding; defaults to `off`
%> # `selectorsSortingMethod` denotes selector sorting method; can be `natural` or `standard`; defaults to `standard`
%> # `specialComments` denotes a number of /*! ... */ comments preserved; defaults to `all`
%> # `tidyAtRules` controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `on`
%> # `tidyBlockScopes` controls block scopes (e.g. `@media`) optimizing; defaults to `on`
%> # `tidySelectors` controls selectors optimizing; defaults to `on`

%> cleancss -O2 one.css
%> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css
%> cleancss -O2 all:off;removeDuplicateRules:on one.css
%> # `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`
%> # `mergeIntoShorthands` controls merging properties into shorthands; defaults to `on`
%> # `mergeMedia` controls `@media` merging; defaults to `on`
%> # `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`
%> # `mergeSemantically` controls semantic merging; defaults to `off`
%> # `overrideProperties` controls property overriding based on understandability; defaults to `on`
%> # `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`
%> # `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`
%> # `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`
%> # `removeDuplicateRules` controls duplicate rules removing; defaults to `on`
%> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)
%> # `removeUnusedAtRules` controls unused at rule removing; defaults to `off` (since 4.1.0)
%> # `restructureRules` controls rule restructuring; defaults to `off`
%> # `skipProperties` controls which properties won't be optimized, defaults to empty list which means all will be optimized (since 4.1.0)
February 2020 cleancss 4.3.0