From: Jakub Pawlowicz Date: Wed, 18 Jun 2014 21:43:09 +0000 (+0100) Subject: Fixes #297 - box-shadow zeros minification. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f55037bb0fe22c9c9de0e5105c68bf763d719240;p=clean-css.git Fixes #297 - box-shadow zeros minification. --- diff --git a/History.md b/History.md index 418ac8d0..cd57e649 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +[2.2.2 / 2014-xx-xx](https://github.com/GoalSmashers/clean-css/compare/v2.2.1...v2.2.2) +================== + +* Fixed issue [#297](https://github.com/GoalSmashers/clean-css/issues/297) - box-shadow zeros minification. + [2.2.1 / 2014-06-14](https://github.com/GoalSmashers/clean-css/compare/v2.2.0...2.2.1) ================== diff --git a/lib/clean.js b/lib/clean.js index d4e00288..4abf14bd 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -313,7 +313,7 @@ var minify = function(data, callback) { replace(/background:(?:none|transparent)([;}])/g, 'background:0 0$1'); // multiple zeros into one - replace(/box-shadow:0 0 0( 0)?([^\.])/g, 'box-shadow:0 0$2'); + replace(/box-shadow:0 0 0 0([^\.])/g, 'box-shadow:0 0$1'); replace(/:0 0 0 0([^\.])/g, ':0$1'); replace(/([: ,=\-])0\.(\d)/g, '$1.$2'); diff --git a/test/unit-test.js b/test/unit-test.js index 298e4d0f..f6f8e513 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -412,10 +412,12 @@ vows.describe('clean-units').addBatch({ 'a{box-shadow:0 0 0 0}', 'a{box-shadow:0 0}' ], - 'box shadow with three zeros ': [ - 'a{box-shadow:0 0 0}', - 'a{box-shadow:0 0}' + 'box shadow with two zeros': 'a{box-shadow:0 0}', + 'box shadow with three zeros and a fraction': [ + 'a{box-shadow:0 0 0 0.15em #EBEBEB}', + 'a{box-shadow:0 0 0 .15em #EBEBEB}' ], + 'box shadow with three zeros and a value': 'a{box-shadow:0 0 0 15px #EBEBEB}', 'rems': [ 'div{width:0rem;height:0rem}', 'div{width:0;height:0}'