Refixes #629 - source maps & background shorthands.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 25 Aug 2015 07:10:57 +0000 (08:10 +0100)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 25 Aug 2015 07:12:29 +0000 (08:12 +0100)
History.md
lib/properties/break-up.js
test/source-map-test.js

index 6f5d104..27f6c7f 100644 (file)
@@ -18,6 +18,7 @@
 * Fixed issue [#644](https://github.com/jakubpawlowicz/clean-css/issues/644) - adds time unit optimizations.
 * Fixed issue [#645](https://github.com/jakubpawlowicz/clean-css/issues/645) - adds bottom to top `media` merging.
 * Fixed issue [#648](https://github.com/jakubpawlowicz/clean-css/issues/648) - adds property level at-rule support.
+* Refixed issue [#629](https://github.com/jakubpawlowicz/clean-css/issues/629) - source maps & background shorthands.
 
 [3.3.9 / 2015-08-09](https://github.com/jakubpawlowicz/clean-css/compare/v3.3.8...v3.3.9)
 ==================
index 9bb4940..41e7e0e 100644 (file)
@@ -86,7 +86,7 @@ function background(property, compactable, validator) {
         } else if (i > 1 && values[i - 2] == '/') {
           size.value = [previousValue, value];
           i -= 2;
-        } else if (values[i - 1] == '/') {
+        } else if (previousValue[0] == '/') {
           size.value = [value];
         } else {
           if (!positionSet)
index 6844846..21bcfdd 100644 (file)
@@ -44,6 +44,14 @@ vows.describe('source-map')
         assert.equal(minified.styles, 'a{background:#fff}');
       }
     },
+    'background position and size': {
+      'topic': function () {
+        return new CleanCSS({ sourceMap: true }).minify('a{background:url(image.png) 0 0 / 100% no-repeat}');
+      },
+      'gets right output': function (minified) {
+        assert.equal(minified.styles, 'a{background:url(image.png) 0 0/100% no-repeat}');
+      }
+    },
     'important': {
       'topic': function () {
         return new CleanCSS({ sourceMap: true }).minify('@font-face{font-family:si}a{font-family:si!important}');