return HexNameShortener.shorten(value);
}
-function pixelLengthMinifier(_, value) {
+function pixelLengthMinifier(_, value, compatibility) {
if (!WHOLE_PIXEL_VALUE.test(value))
return value;
if (intVal === 0)
return match;
- if (intVal * 3 % 4 === 0)
+ if (compatibility.units.pt && intVal * 3 % 4 === 0)
newValue = intVal * 3 / 4 + 'pt';
- if (intVal % 16 === 0)
+ if (compatibility.units.pc && intVal % 16 === 0)
newValue = intVal / 16 + 'pc';
- if (intVal % 96 === 0)
+ if (compatibility.units.in && intVal % 96 === 0)
newValue = intVal / 96 + 'in';
if (newValue)
value = whitespaceMinifier(name, value);
value = precisionMinifier(name, value, options.precision);
- value = pixelLengthMinifier(name, value);
+ value = pixelLengthMinifier(name, value, options.compatibility);
value = timeUnitMinifier(name, value);
value = zeroMinifier(name, value);
if (options.compatibility.properties.zeroUnits) {
assert.isFalse(options.selectors.adjacentSpace);
assert.isFalse(options.selectors.ie7Hack);
assert.isTrue(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isTrue(options.units.rem);
assert.isTrue(options.units.vh);
assert.isTrue(options.units.vm);
assert.isFalse(options.selectors.adjacentSpace);
assert.isFalse(options.selectors.ie7Hack);
assert.isTrue(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isFalse(options.units.rem);
assert.isTrue(options.units.vh);
assert.isTrue(options.units.vm);
assert.isFalse(options.selectors.adjacentSpace);
assert.isFalse(options.selectors.ie7Hack);
assert.isFalse(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isFalse(options.units.rem);
assert.isFalse(options.units.vh);
assert.isFalse(options.units.vm);
assert.isFalse(options.selectors.adjacentSpace);
assert.isTrue(options.selectors.ie7Hack);
assert.isFalse(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isFalse(options.units.rem);
assert.isFalse(options.units.vh);
assert.isFalse(options.units.vm);
assert.isFalse(options.selectors.adjacentSpace);
assert.isFalse(options.selectors.ie7Hack);
assert.isFalse(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isFalse(options.units.rem);
assert.isFalse(options.units.vh);
assert.isFalse(options.units.vm);
assert.isFalse(options.selectors.adjacentSpace);
assert.isFalse(options.selectors.ie7Hack);
assert.isTrue(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isTrue(options.units.rem);
assert.isTrue(options.units.vh);
assert.isTrue(options.units.vm);
assert.isFalse(options.selectors.adjacentSpace);
assert.isFalse(options.selectors.ie7Hack);
assert.isTrue(options.units.ch);
+ assert.isTrue(options.units.in);
+ assert.isTrue(options.units.pc);
+ assert.isTrue(options.units.pt);
assert.isFalse(options.units.rem);
assert.isTrue(options.units.vh);
assert.isTrue(options.units.vm);