From 89b00d3c8c16a365bc0315299bf96fea3bcb39ab Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Mon, 6 Oct 2014 12:17:03 +0100 Subject: [PATCH] Speeds up minifying zero values. * Checks if zeros are present in property value before proceeding. --- lib/selectors/optimizers/simple.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/selectors/optimizers/simple.js b/lib/selectors/optimizers/simple.js index fda627ec..5383da63 100644 --- a/lib/selectors/optimizers/simple.js +++ b/lib/selectors/optimizers/simple.js @@ -89,6 +89,9 @@ var valueMinifiers = { }; function zeroMinifier(_, value) { + if (value.indexOf('0') == -1) + return value; + return value .replace(/\-0$/g, '0') .replace(/\-0([^\.])/g, '0$1') @@ -120,6 +123,9 @@ function unitMinifier(_, value, unitsRegexp) { } function multipleZerosMinifier(property, value) { + if (value.indexOf('0 0 0 0') == -1) + return value; + if (property.indexOf('box-shadow') > -1) return value == '0 0 0 0' ? '0 0' : value; -- 2.34.1