It turns out unit removal messes up with transforms in IE10-12.
[3.2.0 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.1...HEAD)
==================
+* Fixed issue [#376](https://github.com/jakubpawlowicz/clean-css/issues/376) - option to disable 0[unit] -> 0.
* Fixed issue [#396](https://github.com/jakubpawlowicz/clean-css/issues/396) - better input source maps tracking.
* Fixed issue [#480](https://github.com/jakubpawlowicz/clean-css/issues/480) - extracting upcase property names.
* `'[+-]properties.backgroundSizeMerging'` - turn on / off background-size merging into shorthand
* `'[+-]properties.merging'` - turn on / off property merging based on understandability
* `'[+-]properties.spaceAfterClosingBrace'` - turn on / off removing space after closing brace - `url() no-repeat` into `url()no-repeat`
+* `'[+-]properties.zeroUnits'` - turn on / off units removal after a `0` value
* `'[+-]selectors.adjacentSpace'` - turn on / off extra space before `nav` element
* `'[+-]selectors.ie7Hack'` - turn on / off IE7 selector hack removal (`*+html...`)
* `'[+-]units.rem'` - turn on / off treating `rem` as a proper unit
value = precisionMinifier(property, value, options.precision);
value = zeroMinifier(property, value);
- value = zeroDegMinifier(property, value);
- value = unitMinifier(property, value, options.unitsRegexp);
+ if (options.compatibility.properties.zeroUnits) {
+ value = zeroDegMinifier(property, value);
+ value = unitMinifier(property, value, options.unitsRegexp);
+ }
value = multipleZerosMinifier(property, value);
value = colorMininifier(property, value, options.compatibility);
iePrefixHack: false, // underscore / asterisk prefix hacks on IE
ieSuffixHack: false, // \9 suffix hacks on IE
merging: true, // merging properties into one
- spaceAfterClosingBrace: false // 'url() no-repeat' to 'url()no-repeat'
+ spaceAfterClosingBrace: false, // 'url() no-repeat' to 'url()no-repeat'
+ zeroUnits: true // 0[unit] -> 0
},
selectors: {
adjacentSpace: false, // div+ nav Android stock browser hack
iePrefixHack: true,
ieSuffixHack: true,
merging: false,
- spaceAfterClosingBrace: true
+ spaceAfterClosingBrace: true,
+ zeroUnits: true
},
selectors: {
adjacentSpace: false,
iePrefixHack: true,
ieSuffixHack: true,
merging: false,
- spaceAfterClosingBrace: true
+ spaceAfterClosingBrace: true,
+ zeroUnits: true
},
selectors: {
adjacentSpace: false,
]
})
)
+ .addBatch(
+ propertyContext('zeros with disabled zeroUnits', {
+ '10.0em': [
+ 'a{margin:10.0em}',
+ ['margin:10em']
+ ],
+ '0px': [
+ 'a{margin:0px}',
+ ['margin:0px']
+ ],
+ '0px 0px': [
+ 'a{margin:0px 0px}',
+ ['margin:0px 0px']
+ ],
+ '0deg': [
+ 'div{transform:rotate(0deg) skew(0deg)}',
+ ['transform:rotate(0deg) skew(0deg)']
+ ],
+ '0%': [
+ 'a{height:0%}',
+ ['height:0%']
+ ],
+ '10%': [
+ 'a{width:10%}',
+ ['width:10%']
+ ]
+ }, { compatibility: { properties: { zeroUnits: false } } })
+ )
.addBatch(
propertyContext('comments', {
'comment': [
assert.isFalse(options.properties.backgroundSizeMerging);
assert.isTrue(options.properties.merging);
assert.isFalse(options.properties.spaceAfterClosingBrace);
+ assert.isTrue(options.properties.zeroUnits);
assert.isFalse(options.units.rem);
assert.isTrue(options.colors.opacity);
assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:dir\([a-z-]*\)|:first(?![a-z-])|:fullscreen|:left|:read-only|:read-write|:right)/);
assert.isFalse(options.properties.backgroundSizeMerging);
assert.isFalse(options.properties.merging);
assert.isTrue(options.properties.spaceAfterClosingBrace);
+ assert.isTrue(options.properties.zeroUnits);
assert.isFalse(options.units.rem);
assert.isFalse(options.colors.opacity);
assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/);
assert.isFalse(options.properties.backgroundSizeMerging);
assert.isFalse(options.properties.merging);
assert.isTrue(options.properties.spaceAfterClosingBrace);
+ assert.isTrue(options.properties.zeroUnits);
assert.isFalse(options.units.rem);
assert.isFalse(options.colors.opacity);
assert.deepEqual(options.selectors.special, /(\-moz\-|\-ms\-|\-o\-|\-webkit\-|:focus|:before|:after|:root|:nth|:first\-of|:last|:only|:empty|:target|:checked|::selection|:enabled|:disabled|:not)/);