From 6916f8cc0b647a35b0b1b9029c958ad893a2e11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Tiigi?= Date: Wed, 30 May 2012 13:01:56 +0300 Subject: [PATCH] Fix last rule being ignored if empty indents at the end of the file --- lib/lexer.js | 1 + test/cases/whitespace.oes.css | 4 ++++ test/cases/whitespace.oes.styl | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 test/cases/whitespace.oes.css create mode 100644 test/cases/whitespace.oes.styl diff --git a/lib/lexer.js b/lib/lexer.js index 18c203ae2..f030d4c75 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -67,6 +67,7 @@ function Lexer(str, options) { }; this.str = str + .replace(/\s+$/, '\n') .replace(/\r\n?/g, '\n') .replace(/\\ *\n/g, ' ') .replace(/([,:(]) *\n\s*/g, comment) diff --git a/test/cases/whitespace.oes.css b/test/cases/whitespace.oes.css new file mode 100644 index 000000000..4e9ab9c54 --- /dev/null +++ b/test/cases/whitespace.oes.css @@ -0,0 +1,4 @@ +.myclass { + display: block; + color: #000; +} \ No newline at end of file diff --git a/test/cases/whitespace.oes.styl b/test/cases/whitespace.oes.styl new file mode 100644 index 000000000..db47e757c --- /dev/null +++ b/test/cases/whitespace.oes.styl @@ -0,0 +1,5 @@ +// Last line in this file has 4 spaces. +.myclass + display block + color black + \ No newline at end of file