From 3814a3495f7c7879415373b6d6e8fd6cdf6ddffe Mon Sep 17 00:00:00 2001 From: GoalSmashers Date: Thu, 14 Feb 2013 22:29:25 +0100 Subject: [PATCH] Fixes #66 - line breaks without extra spaces should be handled correctly. --- lib/clean.js | 2 +- test/unit-test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/clean.js b/lib/clean.js index 464b3e82..25119390 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -89,7 +89,7 @@ var CleanCSS = { // line breaks if (!options.keepBreaks) - replace(/[\r]?\n/g, ''); + replace(/[\r]?\n/g, ' '); // multiple whitespace replace(/[\t ]+/g, ' '); diff --git a/test/unit-test.js b/test/unit-test.js index 45c76c37..995eaa39 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -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': [ -- 2.34.1