Fixes #165 - adds removing extra space after rgba/hsla declarations.
authorGoalSmashers <jakub@goalsmashers.com>
Sat, 16 Nov 2013 09:59:18 +0000 (10:59 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Sat, 16 Nov 2013 09:59:18 +0000 (10:59 +0100)
History.md
lib/clean.js
test/unit-test.js

index 1297c53..78a675d 100644 (file)
@@ -1,3 +1,8 @@
+[2.1.0 / 2013-xx-xx (UNRELEASED)](https://github.com/GoalSmashers/clean-css/compare/v2.0.0...HEAD)
+==================
+
+* Fixed issue [#165](https://github.com/GoalSmashers/clean-css/issues/165) - extra space after trailing parenthesis.
+
 [2.0.1 / 2013-11-14](https://github.com/GoalSmashers/clean-css/compare/v2.0.0...v2.0.1)
 ==================
 
index 9b1f4ff..5238595 100644 (file)
@@ -255,6 +255,9 @@ module.exports = function(options) {
       return match.replace(/\+/g, ' + ');
     });
 
+    // remove space after (rgba|hsla) declaration - see #165
+    replace(/(rgba|hsla)\(([^\)]+)\) /g, '$1($2)');
+
     if (!options.noAdvanced) {
       replace(function optimizeSelectors() {
         data = new SelectorsOptimizer(data, {
index 42eba55..d0b95a4 100644 (file)
@@ -176,6 +176,22 @@ vows.describe('clean-units').addBatch({
     'in content preceded by line break': [
       '.content{display:block}#foo{' + lineBreak + 'content:"x"}',
       '.content{display:block}#foo{content:"x"}'
+    ],
+    'after rgb': [
+      'a{text-shadow:rgb(255,0,1) 1px 1px}',
+      'a{text-shadow:#ff0001 1px 1px}'
+    ],
+    'after rgba': [
+      'a{text-shadow:rgba(255,0,0,1) 0 1px}',
+      'a{text-shadow:rgba(255,0,0,1)0 1px}'
+    ],
+    'after hsl': [
+      'a{text-shadow:hsl(240,100%,40%) -1px 1px}',
+      'a{text-shadow:#00c -1px 1px}'
+    ],
+    'after hsla': [
+      'a{text-shadow:hsla(240,100%,40%,.5) -1px 1px}',
+      'a{text-shadow:hsla(240,100%,40%,.5)-1px 1px}'
     ]
   }),
   'line breaks': cssContext({