Fixes #297 - box-shadow zeros minification.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Wed, 18 Jun 2014 21:43:09 +0000 (22:43 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Wed, 18 Jun 2014 21:51:35 +0000 (22:51 +0100)
History.md
lib/clean.js
test/unit-test.js

index 418ac8d..cd57e64 100644 (file)
@@ -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)
 ==================
 
index d4e0028..4abf14b 100644 (file)
@@ -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');
 
index 298e4d0..f6f8e51 100644 (file)
@@ -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}'