From 48b379bbd0ceef9b599a81ff8bfe5ec55ffb3a9d Mon Sep 17 00:00:00 2001 From: Bass Jobsen Date: Thu, 29 Jan 2015 00:27:09 +0100 Subject: [PATCH] endlines and comments possible fix for https://github.com/less/less.js/issues/2370 I have used the following command to test this issue: `printf "p {\r//less\rc:1;\r}\r" | lessc -` I'm not sure if this the most efficient fix. I also tried `var nextNewLine = inp.substr(parserInput.i + 1).search(/\n|\r/);` to replace the `indexOf` but then i expect possible mismatches for `\r\n` which match on the first `\r`. --- lib/less/parser/parser-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/less/parser/parser-input.js b/lib/less/parser/parser-input.js index ad799e85..7755d205 100644 --- a/lib/less/parser/parser-input.js +++ b/lib/less/parser/parser-input.js @@ -126,7 +126,7 @@ module.exports = function() { curr = parserInput.i - currentPos, endIndex = parserInput.i + current.length - curr, mem = (parserInput.i += length), - inp = input, + inp = input.replace(/\r\n|\r/gm, "\n"), c, nextChar, comment; for (; parserInput.i < endIndex; parserInput.i++) {