From 30e47bea8e91dde12136b0aad614a290d52eece7 Mon Sep 17 00:00:00 2001 From: Albert Kwong Date: Tue, 27 Jan 2015 20:27:08 +0800 Subject: [PATCH] append a space on every line before compile The dust compiler removes leading spaces on every line before joining them together. So, if a trailing space is missing, two lines may join together without any space between time, which is often unexpected by the template writer. --- lib/klei/dust.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/klei/dust.js b/lib/klei/dust.js index 6608f30..2c5503c 100644 --- a/lib/klei/dust.js +++ b/lib/klei/dust.js @@ -184,6 +184,7 @@ var kleiDust = function () { try { str = fs.readFileSync(path, 'utf8'); + str = str.replace(/(\r\n|\n|\r)/gm," \n"); setCachedString(path, str); callback(null, str); } catch(err) {