Fixes #326 - regression issue in background-size minification.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 28 Jul 2014 21:38:00 +0000 (22:38 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Mon, 28 Jul 2014 21:43:04 +0000 (22:43 +0100)
History.md
lib/properties/processable.js
test/unit-test.js

index c595724..54b29c2 100644 (file)
@@ -1,3 +1,8 @@
+[2.2.11 / 2014-xx-xx](https://github.com/GoalSmashers/clean-css/compare/v2.2.10...v2.2.11)
+==================
+
+* Fixed issue [#326](https://github.com/GoalSmashers/clean-css/issues/326) - background-size regression.
+
 [2.2.10 / 2014-07-27](https://github.com/GoalSmashers/clean-css/compare/v2.2.9...v2.2.10)
 ==================
 
index 9d3e0ae..4601660 100644 (file)
@@ -444,6 +444,11 @@ module.exports = (function () {
         if (meta && meta.partsCount && meta.position < meta.partsCount - 1 && processable[token.prop].multiValueLastOnly)
           continue;
 
+        var requiresPreceeding = processable[token.prop].shorthandFollows;
+        if (requiresPreceeding && (tokens[i - 1].value == processable[requiresPreceeding].defaultValue)) {
+          result.value += ' ' + tokens[i - 1].value;
+        }
+
         result.value += (processable[token.prop].prefixShorthandValueWith || ' ') + token.value;
       }
 
@@ -646,7 +651,8 @@ module.exports = (function () {
       canOverride: canOverride.always,
       defaultValue: 'auto',
       shortestValue: '0 0',
-      prefixShorthandValueWith: '/'
+      prefixShorthandValueWith: '/',
+      shorthandFollows: 'background-position'
     },
     'background-attachment': {
       canOverride: canOverride.always,
index bad994b..c8dd594 100644 (file)
@@ -2017,6 +2017,10 @@ title']{display:block}",
     'with background-position shorthands and spaces': [
       'a{background:url(top.jpg) 0 / cover no-repeat}',
       'a{background:url(top.jpg) 0/cover no-repeat}'
+    ],
+    'with background-size property': [
+      'a{background:none;background-image:url(1.png);background-size:28px 28px}',
+      'a{background:url(1.png) 0 0/28px 28px}'
     ]
   }),
   'misc advanced': cssContext({