From a857a9eff6ce6a09eaba2d219fc615f3d0edbeba Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Tue, 10 Jan 2017 12:11:22 +0100 Subject: [PATCH] Adds examples of `all` keyword in level 1/2 optimizations. Why: * So the option is documented properly. --- README.md | 22 ++++++++++++++++++++++ bin/cleancss | 2 ++ 2 files changed, 24 insertions(+) diff --git a/README.md b/README.md index 729c8838..4cfed0d9 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ Level 1 optimizations (default): ```bash 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` @@ -146,6 +147,7 @@ Level 2 optimizations: ```bash cleancss -O2 one.css cleancss -O2 mediaMerging:off;restructuring:off;semanticMerging:on;shorthandCompacting:off one.css +cleancss -O2 all:off;duplicateRulesRemoving:on one.css # `adjacentRulesMerging` controls adjacent rules merging; defaults to `on` # `duplicateFontRulesRemoving` controls duplicate `@font-face` removing; defaults to `on` # `duplicateMediaRemoving` controls duplicate `@media` removing; defaults to `on` @@ -227,6 +229,16 @@ new CleanCSS({ } } }); + +// level 1 optimizations `all` keyword +new CleanCSS({ + level: { + 1: { + all: false // sets all values to `false` + tidySelectors: true // turns on optimizing selectors + } + } +}); ``` ```js @@ -247,6 +259,16 @@ new CleanCSS({ } } }); + +// level 2 optimizations `all` keyword +new CleanCSS({ + level: { + 1: { + all: false // sets all values to `false` + duplicateRulesRemoving: true // turns on removing duplicate rules + } + } +}); ``` #### How to make sure remote `@import`s are processed correctly? diff --git a/bin/cleancss b/bin/cleancss index 645fac3d..464c9ebc 100755 --- a/bin/cleancss +++ b/bin/cleancss @@ -39,6 +39,7 @@ commands.on('--help', function () { console.log(' Level 1 optimizations:'); console.log(' %> cleancss -O1 one.css'); console.log(' %> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css'); + console.log(' %> cleancss -O1 all:off;specialComments:1 one.css'); console.log(' %> # `cleanupCharsets` controls `@charset` moving to the front of a stylesheet; defaults to `on`'); console.log(' %> # `normalizeUrls` controls URL normalzation; default to `on`'); console.log(' %> # `optimizeBackground` controls `background` property optimizatons; defaults to `on`'); @@ -62,6 +63,7 @@ commands.on('--help', function () { console.log(' Level 2 optimizations:'); console.log(' %> cleancss -O2 one.css'); console.log(' %> cleancss -O2 mediaMerging:off;restructuring:off;semanticMerging:on;shorthandCompacting:off one.css'); + console.log(' %> cleancss -O2 all:off;duplicateRulesRemoving:on one.css'); console.log(' %> # `adjacentRulesMerging` controls adjacent rules merging; defaults to `on`'); console.log(' %> # `duplicateFontRulesRemoving` controls duplicate `@font-face` removing; defaults to `on`'); console.log(' %> # `duplicateMediaRemoving` controls duplicate `@media` removing; defaults to `on`'); -- 2.34.1