Skip to content

Commit 29c0561

Browse files
Cleans up CLI help but leaves all examples in README.md.
1 parent 056208b commit 29c0561

File tree

2 files changed

+30
-79
lines changed

2 files changed

+30
-79
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,21 @@ clean-css-cli 4.3 introduces the following changes / features:
116116
## CLI options
117117

118118
```shell
119-
-h, --help output usage information
120-
-v, --version output the version number
121119
-b, --batch If enabled, optimizes input files one by one instead of joining them together
122120
-c, --compatibility [ie7|ie8] Force compatibility mode (see Readme for advanced examples)
123121
-d, --debug Shows debug information (minification time & compression efficiency)
124122
-f, --format <options> Controls output formatting, see examples below
123+
-h, --help output usage information
125124
-o, --output [output-file] Use [output-file] as output instead of STDOUT
126125
-O <n> [optimizations] Turn on level <n> optimizations; optionally accepts a list of fine-grained options, defaults to `1`, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number)
126+
-v, --version output the version number
127127
--inline [rules] Enables inlining for listed sources (defaults to `local`)
128128
--inline-timeout [seconds] Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)
129+
--input-source-map [file] Specifies the path of the input source map file
129130
--remove-inlined-files Remove files inlined in <source-file ...> or via `@import` statements
130-
--skip-rebase Disable URLs rebasing
131131
--source-map Enables building input's source map
132132
--source-map-inline-sources Enables inlining sources inside source maps
133-
--input-source-map [file] Specifies the path of the input source map file
133+
--with-rebase Disable URLs rebasing
134134
```
135135
136136
## Compatibility modes

index.js

Lines changed: 26 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -21,100 +21,51 @@ function cli(process, beforeMinifyCallback) {
2121

2222
// Specify commander options to parse command line params correctly
2323
program
24-
.version(buildVersion, '-v, --version')
2524
.usage('[options] <source-file ...>')
2625
.option('-b, --batch', 'If enabled, optimizes input files one by one instead of joining them together')
2726
.option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode (see Readme for advanced examples)')
2827
.option('-d, --debug', 'Shows debug information (minification time & compression efficiency)')
2928
.option('-f, --format <options>', 'Controls output formatting, see examples below')
29+
.option('-h, --help', 'display this help')
3030
.option('-o, --output [output-file]', 'Use [output-file] as output instead of STDOUT')
3131
.option('-O <n> [optimizations]', 'Turn on level <n> optimizations; optionally accepts a list of fine-grained options, defaults to `1`, see examples below, IMPORTANT: the prefix is O (a capital o letter), NOT a 0 (zero, a number)', function (val) { return Math.abs(parseInt(val)); })
32+
.version(buildVersion, '-v, --version')
3233
.option('--batch-suffix <suffix>', 'A suffix (without extension) appended to input file name when processing in batch mode (`-min` is the default)', '-min')
3334
.option('--inline [rules]', 'Enables inlining for listed sources (defaults to `local`)')
3435
.option('--inline-timeout [seconds]', 'Per connection timeout when fetching remote stylesheets (defaults to 5 seconds)', parseFloat)
36+
.option('--input-source-map [file]', 'Specifies the path of the input source map file')
3537
.option('--remove-inlined-files', 'Remove files inlined in <source-file ...> or via `@import` statements')
36-
.option('--with-rebase', 'Enable URLs rebasing')
3738
.option('--source-map', 'Enables building input\'s source map')
3839
.option('--source-map-inline-sources', 'Enables inlining sources inside source maps')
39-
.option('--input-source-map [file]', 'Specifies the path of the input source map file');
40+
.option('--with-rebase', 'Enable URLs rebasing');
4041

4142
program.on('--help', function () {
42-
console.log(' Examples:\n');
43-
console.log(' %> cleancss one.css');
44-
console.log(' %> cleancss -o one-min.css one.css');
45-
console.log(' %> cleancss -o merged-and-minified.css one.css two.css three.css');
46-
console.log(' %> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz');
4743
console.log('');
48-
console.log(' Formatting options:');
49-
console.log(' %> cleancss --format beautify one.css');
50-
console.log(' %> cleancss --format keep-breaks one.css');
51-
console.log(' %> cleancss --format \'indentBy:1;indentWith:tab\' one.css');
52-
console.log(' %> cleancss --format \'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on\' one.css');
53-
console.log(' %> cleancss --format \'breaks:afterBlockBegins=2;spaces:aroundSelectorRelation=on\' one.css');
54-
console.log(' %> # `breaks` controls where to insert breaks');
55-
console.log(' %> # `afterAtRule` controls if a line break comes after an at-rule; e.g. `@charset`; defaults to `off` (alias to `false`); accepts number of line breaks as an argument too');
56-
console.log(' %> # `afterBlockBegins` controls if a line break comes after a block begins; e.g. `@media`; defaults to `off`; accepts number of line breaks as an argument too');
57-
console.log(' %> # `afterBlockEnds` controls if a line break comes after a block ends, defaults to `off`; accepts number of line breaks as an argument too');
58-
console.log(' %> # `afterComment` controls if a line break comes after a comment; defaults to `off`; accepts number of line breaks as an argument too');
59-
console.log(' %> # `afterProperty` controls if a line break comes after a property; defaults to `off`; accepts number of line breaks as an argument too');
60-
console.log(' %> # `afterRuleBegins` controls if a line break comes after a rule begins; defaults to `off`; accepts number of line breaks as an argument too');
61-
console.log(' %> # `afterRuleEnds` controls if a line break comes after a rule ends; defaults to `off`; accepts number of line breaks as an argument too');
62-
console.log(' %> # `beforeBlockEnds` controls if a line break comes before a block ends; defaults to `off`; accepts number of line breaks as an argument too');
63-
console.log(' %> # `betweenSelectors` controls if a line break comes between selectors; defaults to `off`; accepts number of line breaks as an argument too');
64-
console.log(' %> # `indentBy` controls number of characters to indent with; defaults to `0`');
65-
console.log(' %> # `indentWith` controls a character to indent with, can be `space` or `tab`; defaults to `space`');
66-
console.log(' %> # `spaces` controls where to insert spaces');
67-
console.log(' %> # `aroundSelectorRelation` controls if spaces come around selector relations; e.g. `div > a`; defaults to `off`');
68-
console.log(' %> # `beforeBlockBegins` controls if a space comes before a block begins; e.g. `.block {`; defaults to `off`');
69-
console.log(' %> # `beforeValue` controls if a space comes before a value; e.g. `width: 1rem`; defaults to `off`');
70-
console.log(' %> # `wrapAt` controls maximum line length; defaults to `off`');
44+
console.log('Examples:\n');
45+
console.log(' %> cleancss one.css');
46+
console.log(' %> cleancss -o one-min.css one.css');
47+
console.log(' %> cleancss -o merged-and-minified.css one.css two.css three.css');
48+
console.log(' %> cleancss one.css two.css three.css | gzip -9 -c > merged-minified-and-gzipped.css.gz');
49+
console.log('');
50+
console.log('Formatting options:');
51+
console.log(' %> cleancss --format beautify one.css');
52+
console.log(' %> cleancss --format keep-breaks one.css');
53+
console.log(' %> cleancss --format \'indentBy:1;indentWith:tab\' one.css');
54+
console.log(' %> cleancss --format \'breaks:afterBlockBegins=on;spaces:aroundSelectorRelation=on\' one.css');
55+
console.log(' %> cleancss --format \'breaks:afterBlockBegins=2;spaces:aroundSelectorRelation=on\' one.css');
7156
console.log('');
72-
console.log(' Level 0 optimizations:');
73-
console.log(' %> cleancss -O0 one.css');
57+
console.log('Level 0 optimizations:');
58+
console.log(' %> cleancss -O0 one.css');
7459
console.log('');
75-
console.log(' Level 1 optimizations:');
76-
console.log(' %> cleancss -O1 one.css');
77-
console.log(' %> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css');
78-
console.log(' %> cleancss -O1 all:off;specialComments:1 one.css');
79-
console.log(' %> # `cleanupCharsets` controls `@charset` moving to the front of a stylesheet; defaults to `on`');
80-
console.log(' %> # `normalizeUrls` controls URL normalzation; default to `on`');
81-
console.log(' %> # `optimizeBackground` controls `background` property optimizatons; defaults to `on`');
82-
console.log(' %> # `optimizeBorderRadius` controls `border-radius` property optimizatons; defaults to `on`');
83-
console.log(' %> # `optimizeFilter` controls `filter` property optimizatons; defaults to `on`');
84-
console.log(' %> # `optimizeFontWeight` controls `font-weight` property optimizatons; defaults to `on`');
85-
console.log(' %> # `optimizeOutline` controls `outline` property optimizatons; defaults to `on`');
86-
console.log(' %> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)');
87-
console.log(' %> # `removeNegativePaddings` controls removing negative paddings; defaults to `on`');
88-
console.log(' %> # `removeQuotes` controls removing quotes when unnecessary; defaults to `on`');
89-
console.log(' %> # `removeWhitespace` controls removing unused whitespace; defaults to `on`');
90-
console.log(' %> # `replaceMultipleZeros` contols removing redundant zeros; defaults to `on`');
91-
console.log(' %> # `replaceTimeUnits` controls replacing time units with shorter values; defaults to `on');
92-
console.log(' %> # `replaceZeroUnits` controls replacing zero values with units; defaults to `on`');
93-
console.log(' %> # `roundingPrecision` rounds pixel values to `N` decimal places; `off` disables rounding; defaults to `off`');
94-
console.log(' %> # `selectorsSortingMethod` denotes selector sorting method; can be `natural` or `standard`; defaults to `standard`');
95-
console.log(' %> # `specialComments` denotes a number of /*! ... */ comments preserved; defaults to `all`');
96-
console.log(' %> # `tidyAtRules` controls at-rules (e.g. `@charset`, `@import`) optimizing; defaults to `on`');
97-
console.log(' %> # `tidyBlockScopes` controls block scopes (e.g. `@media`) optimizing; defaults to `on`');
98-
console.log(' %> # `tidySelectors` controls selectors optimizing; defaults to `on`');
60+
console.log('Level 1 optimizations:');
61+
console.log(' %> cleancss -O1 one.css');
62+
console.log(' %> cleancss -O1 removeQuotes:off;roundingPrecision:4;specialComments:1 one.css');
63+
console.log(' %> cleancss -O1 all:off;specialComments:1 one.css');
9964
console.log('');
100-
console.log(' Level 2 optimizations:');
101-
console.log(' %> cleancss -O2 one.css');
102-
console.log(' %> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css');
103-
console.log(' %> cleancss -O2 all:off;removeDuplicateRules:on one.css');
104-
console.log(' %> # `mergeAdjacentRules` controls adjacent rules merging; defaults to `on`');
105-
console.log(' %> # `mergeIntoShorthands` controls merging properties into shorthands; defaults to `on`');
106-
console.log(' %> # `mergeMedia` controls `@media` merging; defaults to `on`');
107-
console.log(' %> # `mergeNonAdjacentRules` controls non-adjacent rule merging; defaults to `on`');
108-
console.log(' %> # `mergeSemantically` controls semantic merging; defaults to `off`');
109-
console.log(' %> # `overrideProperties` controls property overriding based on understandability; defaults to `on`');
110-
console.log(' %> # `reduceNonAdjacentRules` controls non-adjacent rule reducing; defaults to `on`');
111-
console.log(' %> # `removeDuplicateFontRules` controls duplicate `@font-face` removing; defaults to `on`');
112-
console.log(' %> # `removeDuplicateMediaBlocks` controls duplicate `@media` removing; defaults to `on`');
113-
console.log(' %> # `removeDuplicateRules` controls duplicate rules removing; defaults to `on`');
114-
console.log(' %> # `removeEmpty` controls removing empty rules and nested blocks; defaults to `on` (since 4.1.0)');
115-
console.log(' %> # `removeUnusedAtRules` controls unused at rule removing; defaults to `off` (since 4.1.0)');
116-
console.log(' %> # `restructureRules` controls rule restructuring; defaults to `off`');
117-
console.log(' %> # `skipProperties` controls which properties won\'t be optimized, defaults to empty list which means all will be optimized (since 4.1.0)');
65+
console.log('Level 2 optimizations:');
66+
console.log(' %> cleancss -O2 one.css');
67+
console.log(' %> cleancss -O2 mergeMedia:off;restructureRules:off;mergeSemantically:on;mergeIntoShorthands:off one.css');
68+
console.log(' %> cleancss -O2 all:off;removeDuplicateRules:on one.css');
11869

11970
process.exit();
12071
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy