From c84f7656aac3d1f4d27d0b5618e8b21ce0d30d19 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Fri, 20 Mar 2015 14:06:02 -0300 Subject: [PATCH] Fixes #245, fixes #180. Add Preserve new lines support for LESS/SCSS --- lib/langs/css-prettydiff-beautify.coffee | 4 +++- lib/language-options.coffee | 7 +++++++ package.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/langs/css-prettydiff-beautify.coffee b/lib/langs/css-prettydiff-beautify.coffee index b1ff492..8b79b08 100644 --- a/lib/langs/css-prettydiff-beautify.coffee +++ b/lib/langs/css-prettydiff-beautify.coffee @@ -7,7 +7,9 @@ module.exports = (text, options, callback) -> mode: "beautify" inchar: options.indent_character insize: options.indent_size - alphasort: options.alphasort || false + alphasort: options.alphasort or false + preserve: (if (options.preserve_newlines is true ) then \ + "all" else "none") output = prettydiff.api(args) result = output[0] diff --git a/lib/language-options.coffee b/lib/language-options.coffee index e2311e1..f2ea59b 100644 --- a/lib/language-options.coffee +++ b/lib/language-options.coffee @@ -166,6 +166,13 @@ module.exports = type: 'boolean' default: false description: "Add a newline between CSS rules" + css_preserve_newlines: + type: 'boolean' + default: false + description: "(Only LESS/SASS/SCSS with Prettydiff) "+ + "Retain empty lines. "+ + "Consecutive empty lines will be converted to a single empty line." + # HTML html_htmlbeautifier_path: diff --git a/package.json b/package.json index c2e33ab..17357aa 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "loophole": "^1.0.0", "node-dir": "^0.1.6", "node-uuid": "^1.4.1", - "prettydiff": "^1.11.0", + "prettydiff": "^1.11.2", "space-pen": "^4.3.0", "strip-json-comments": "^0.1.3", "temp": "^0.8.0",