Fixes #66 - line breaks without extra spaces should be handled correctly.
authorGoalSmashers <jakub@goalsmashers.com>
Thu, 14 Feb 2013 21:29:25 +0000 (22:29 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Thu, 14 Feb 2013 21:29:25 +0000 (22:29 +0100)
lib/clean.js
test/unit-test.js

index 464b3e8..2511939 100644 (file)
@@ -89,7 +89,7 @@ var CleanCSS = {
 
     // line breaks
     if (!options.keepBreaks)
-      replace(/[\r]?\n/g, '');
+      replace(/[\r]?\n/g, ' ');
 
     // multiple whitespace
     replace(/[\t ]+/g, ' ');
index 45c76c3..995eaa3 100644 (file)
@@ -123,6 +123,10 @@ vows.describe('clean-units').addBatch({
       '@media (   min-width: 980px ) {\n#page .span4 {\nwidth: 250px;\n}\n\n.row {\nmargin-left: -10px;\n}\n}',
       '@media (min-width:980px){#page .span4{width:250px}.row{margin-left:-10px}}',
     ],
+    'line breaks in media queries': [
+      '@media\nonly screen and (max-width: 1319px) and (min--moz-device-pixel-ratio: 1.5),\nonly screen and (max-width: 1319px) and (-moz-min-device-pixel-ratio: 1.5)\n{ a { color:#000 } }',
+      '@media only screen and (max-width:1319px) and (min--moz-device-pixel-ratio:1.5),only screen and (max-width:1319px) and (-moz-min-device-pixel-ratio:1.5){a{color:#000}}'
+    ],
     'in content preceded by #content': '#content{}#foo{content:"\00BB  "}',
     'in content preceded by .content': '.content{}#foo{content:"\00BB  "}',
     'in content preceded by line break': [