* Use `roundingPrecision: -1` or `--rounding-precision \\-1`.
* Adds more granular control over compatibility settings.
* Allows `target` option to be a path to a folder instead of a file.
+* Allows disabling rounding precision. By [@superlukas](https://github.com/superlukas).
* Breaks 2.x compatibility for using CleanCSS as a function.
* Reworks minification to tokenize first then minify.
See [changes](https://github.com/jakubpawlowicz/clean-css/compare/b06f37d...dd8c14a).
--skip-advanced Disable advanced optimizations - selector & property merging,
reduction, etc.
--skip-aggressive-merging Disable properties merging based on their order
---rounding-precision [N] Rounds pixel values to `N` decimal places, defaults to 2
+--rounding-precision [N] Rounds to `N` decimal places. Defaults to 2. -1 disables rounding.
-c, --compatibility [ie7|ie8] Force compatibility mode (see Readme for advanced examples)
-d, --debug Shows debug information (minification time & compression efficiency)
```
* `rebase` - set to false to skip URL rebasing
* `relativeTo` - path to __resolve__ relative `@import` rules and URLs
* `root` - path to __resolve__ absolute `@import` rules and __rebase__ relative URLs
-* `roundingPrecision` - Rounding precision, defaults to 2.
+* `roundingPrecision` - rounding precision; defaults to `2`; `-1` disables rounding
* `target` - path to a folder or an output file to which __rebase__ all URLs
### How to use clean-css with build tools?
.option('--skip-rebase', 'Disable URLs rebasing')
.option('--skip-advanced', 'Disable advanced optimizations - selector & property merging, reduction, etc.')
.option('--skip-aggressive-merging', 'Disable properties merging based on their order')
- .option('--rounding-precision [n]', 'Rounds pixel values to `N` decimal places, defaults to 2', parseInt)
+ .option('--rounding-precision [n]', 'Rounds to `N` decimal places. Defaults to 2. -1 disables rounding.', parseInt)
.option('-c, --compatibility [ie7|ie8]', 'Force compatibility mode (see Readme for advanced examples)')
.option('-t, --timeout [seconds]', 'Per connection timeout when fetching remote @imports (defaults to 5 seconds)')
.option('-d, --debug', 'Shows debug information (minification time & compression efficiency)');
}
function precisionMinifier(_, value, precisionOptions) {
- if (value.indexOf('.') === -1)
+ if (precisionOptions.value === -1 || value.indexOf('.') === -1)
return value;
return value
'should keep 0 decimal places': function(error, stdout) {
assert.equal(stdout, 'div{width:1px}');
}
+ }),
+ disabled: pipedContext('div{width:0.12345px}', '--rounding-precision \\\\-1', {
+ 'should keep all decimal places': function(error, stdout) {
+ assert.equal(stdout, 'div{width:.12345px}');
+ }
})
},
'neighbour merging': {
'div{transform:translateY(-418.5051px)}'
]
}, { roundingPrecision: 4 }),
+ 'floats disabled rounding': cssContext({
+ 'does not round': [
+ 'div{transform:translateY(-418.505123px)}',
+ 'div{transform:translateY(-418.505123px)}'
+ ]
+ }, { roundingPrecision: -1 }),
'colors': cssContext({
'shorten rgb to standard hexadecimal format': [
'a{ color:rgb(5, 10, 15) }',
]
}, { roundingPrecision: 3 })
)
+ .addBatch(
+ propertyContext('rounding disabled', {
+ 'pixels': [
+ 'a{transform:translateY(123.31135px)}',
+ ['transform:translateY(123.31135px)']
+ ],
+ 'percents': [
+ 'a{left:20.1231%}',
+ ['left:20.1231%']
+ ],
+ 'ems': [
+ 'a{left:1.1231em}',
+ ['left:1.1231em']
+ ]
+ }, { roundingPrecision: -1 })
+ )
.addBatch(
propertyContext('units', {
'pixels': [