From: Jakub Pawlowicz Date: Mon, 6 Oct 2014 11:17:03 +0000 (+0100) Subject: Speeds up minifying zero values. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=89b00d3c8c16a365bc0315299bf96fea3bcb39ab;p=clean-css.git Speeds up minifying zero values. * Checks if zeros are present in property value before proceeding. --- 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;