From 69a6626fcffc89a795998e9e49667e36540fabcf Mon Sep 17 00:00:00 2001 From: Han Hua Date: Wed, 5 Mar 2014 13:58:54 -0600 Subject: [PATCH] Fixes #252 - box-shadow with three zeros compression --- lib/clean.js | 2 +- test/unit-test.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/clean.js b/lib/clean.js index 1969e4ef..9423e9cb 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -305,7 +305,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$1'); + replace(/box-shadow:0 0 0( 0)?([^\.])/g, 'box-shadow:0 0$2'); 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 819a2ae1..19b68192 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -406,10 +406,14 @@ vows.describe('clean-units').addBatch({ 'div{clip:rect(0px 0px 0px 10px)}', 'div{clip:rect(0 0 0 10px)}' ], - 'box shadow zeros': [ + 'box shadow zeros with four zeros': [ '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}' + ], 'rems': [ 'div{width:0rem;height:0rem}', 'div{width:0;height:0}' -- 2.34.1