Fixes #252 - box-shadow with three zeros compression
authorHan Hua <ahua@groupon.com>
Wed, 5 Mar 2014 19:58:54 +0000 (13:58 -0600)
committerHan Hua <ahua@groupon.com>
Fri, 7 Mar 2014 04:46:05 +0000 (22:46 -0600)
lib/clean.js
test/unit-test.js

index 1969e4e..9423e9c 100644 (file)
@@ -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');
 
index 819a2ae..19b6819 100644 (file)
@@ -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}'