@@ -21,6 +21,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0.
21
21
- [ Install] ( #install )
22
22
- [ Use] ( #use )
23
23
* [ Important: 4.0 breaking changes] ( #important-40-breaking-changes )
24
+ * [ What's new in version 4.1] ( #whats-new-in-version-41 )
24
25
* [ CLI options] ( #cli-options )
25
26
* [ Compatibility modes] ( #compatibility-modes )
26
27
* [ Formatting options] ( #formatting-options )
@@ -29,6 +30,7 @@ Previously a part of clean-css it's a separate package since clean-css 4.0.
29
30
+ [ Level 0 optimizations] ( #level-0-optimizations )
30
31
+ [ Level 1 optimizations] ( #level-1-optimizations )
31
32
+ [ Level 2 optimizations] ( #level-2-optimizations )
33
+ * [ As a module] ( #as-a-module )
32
34
- [ FAQ] ( #faq )
33
35
* [ How to optimize multiple files?] ( #how-to-optimize-multiple-files )
34
36
* [ How to specify a custom rounding precision?] ( #how-to-specify-a-custom-rounding-precision )
@@ -72,6 +74,16 @@ clean-css-cli 4.0 introduces some breaking changes:
72
74
* ` --keep-breaks ` option is replaced with ` --format keep-breaks ` to ease transition;
73
75
* ` --skip-aggressive-merging ` option is removed as aggressive merging is replaced by smarter override merging.
74
76
77
+ ## What's new in version 4.1
78
+
79
+ clean-css-cli 4.1 introduces the following changes / features:
80
+
81
+ * ` --remove-inlined-files ` option for removing files inlined in <source-file ...> or via ` @import ` statements;
82
+ * adds glob pattern matching to source paths, see [ example] ( #how-to-optimize-multiple-files ) ;
83
+ * allows non-boolean compatibility options, e.g. ` --compatibility selectors.mergeLimit=512 ` ;
84
+ * extracts CLI into an importable module, so it can be reused and enhanced if needed;
85
+ * adds ` beforeMinify ` callback as a second argument to CLI module, see [ example use case] ( #as-a-module ) .
86
+
75
87
## CLI options
76
88
77
89
``` shell
@@ -275,6 +287,24 @@ There is an `all` shortcut for toggling all options at the same time, e.g.
275
287
cleancss -O2 all:off; removeDuplicateRules:on one.css
276
288
` ` `
277
289
290
+ # As a module
291
+
292
+ clean-css-cli can also be used as a module in a way of enhancing its functionality in a programmatic way, e.g.
293
+
294
+ ` ` ` js
295
+ #! /usr/bin/env node
296
+
297
+ var cleanCssCli = require(' clean-css-cli' );
298
+
299
+ return cleanCssCli(process, function beforeMinify(cleanCss) {
300
+ cleanCss.options.level[' 1' ].transform = function (propertyName, propertyValue) {
301
+ if (propertyName == ' background-image' && propertyValue.indexOf(' ../valid/path/to' ) == -1) {
302
+ return propertyValue.replace(' url(' , ' url(../valid/path/to/' );
303
+ }
304
+ }
305
+ });
306
+ ` ` `
307
+
278
308
# FAQ
279
309
280
310
More answers can be found in [clean-css FAQ section](https://github.com/jakubpawlowicz/clean-css#faq).
@@ -287,6 +317,12 @@ It can be done by passing in paths to multiple files, e.g.
287
317
cleancss -o merged.min.css one.css two.css three.css
288
318
` ` `
289
319
320
+ Since version 4.1.0 it can also be done using glob pattern matching, e.g.
321
+
322
+ ` ` ` shell
323
+ cleancss -o merged.min.css * .css
324
+ ` ` `
325
+
290
326
# # How to specify a custom rounding precision?
291
327
292
328
The level 1 ` roundingPrecision` optimization option accept a string with per-unit rounding precision settings, e.g.
0 commit comments