Fixes #199 - keeps line breaks if requested when advanced optimizations are off.
authorGoalSmashers <jakub@goalsmashers.com>
Wed, 25 Dec 2013 10:00:44 +0000 (11:00 +0100)
committerGoalSmashers <jakub@goalsmashers.com>
Fri, 3 Jan 2014 11:17:56 +0000 (12:17 +0100)
History.md
lib/clean.js
test/unit-test.js

index ed05013..22283cf 100644 (file)
@@ -9,6 +9,11 @@
 * Fixed issue [#165](https://github.com/GoalSmashers/clean-css/issues/165) - extra space after trailing parenthesis.
 * Fixed issue [#186](https://github.com/GoalSmashers/clean-css/issues/186) - strip unit from 0rem.
 
+[2.0.5 / 2013-xx-xx (UNRELEASED)](https://github.com/GoalSmashers/clean-css/compare/v2.0.4...v2.0.5)
+==================
+
+* Fixed issue [#199](https://github.com/GoalSmashers/clean-css/issues/199) - keep line breaks with no advanced optimizations.
+
 [2.0.4 / 2013-12-19](https://github.com/GoalSmashers/clean-css/compare/v2.0.3...v2.0.4)
 ==================
 
index 12131dd..069f02a 100644 (file)
@@ -286,7 +286,10 @@ CleanCSS.prototype.minify = function(data) {
   // remove space after (rgba|hsla) declaration - see #165
   replace(/(rgba|hsla)\(([^\)]+)\) /g, '$1($2)');
 
-  if (!options.noAdvanced) {
+  if (options.noAdvanced) {
+    if (options.keepBreaks)
+      replace(/\}/g, '}' + lineBreak);
+  } else {
     replace(function optimizeSelectors() {
       data = new SelectorsOptimizer(data, context, {
         keepBreaks: options.keepBreaks,
index 98b57d2..a31ae7b 100644 (file)
@@ -1154,6 +1154,12 @@ title']{display:block}",
   'duplicate selectors with disabled advanced processing': cssContext({
     'of a duplicate selector': 'a,a{color:red}'
   }, { noAdvanced: true }),
+  'line breaks with disabled advanced processing': cssContext({
+    'should be applied': [
+      'a{color:red}p{display:block}',
+      'a{color:red}' + lineBreak + 'p{display:block}',
+    ]
+  }, { noAdvanced: true, keepBreaks: true }),
   'invalid data tokenization': cssContext({
     'extra top-level closing brace': [
       'a{color:red}}p{width:auto}',