Fixes giving `breakWith` option via a string.
authorJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 7 Aug 2018 08:40:06 +0000 (10:40 +0200)
committerJakub Pawlowicz <contact@jakubpawlowicz.com>
Tue, 7 Aug 2018 08:40:06 +0000 (10:40 +0200)
History.md
lib/options/format.js
test/integration-test.js

index 7966851..6ee7381 100644 (file)
@@ -1,3 +1,8 @@
+[4.2.1 / 2018-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v4.2.0...HEAD)
+==================
+
+* Fixes giving `breakWith` option via a string.
+
 [4.2.0 / 2018-08-02](https://github.com/jakubpawlowicz/clean-css/compare/4.1...4.2.0)
 ==================
 
index 3474862..48c7efa 100644 (file)
@@ -147,6 +147,8 @@ function toHash(string) {
         accumulator[name] = parseInt(value);
       } else if (name == 'indentWith') {
         accumulator[name] = mapIndentWith(value);
+      } else if (name == 'breakWith') {
+        accumulator[name] = mapBreakWith(value);
       }
 
       return accumulator;
index 7a97c72..a547f4e 100644 (file)
@@ -316,6 +316,14 @@ vows.describe('integration tests')
       ]
     }, { format: { breaks: { afterProperty: true }, breakWith: 'crlf' } })
   )
+  .addBatch(
+    optimizerContext('CRLF line with format as string', {
+      'uses specified one': [
+        '.block{color:red;display:block}',
+        '.block{color:red;\r\ndisplay:block\r\n}'
+      ]
+    }, { format: 'breaks:afterProperty=on;breakWith:crlf' })
+  )
   .addBatch(
     optimizerContext('LF line breaks', {
       'uses specified one': [