Dynamic text surrounded by new lines
Closed this issue · 1 comments
medatech commented
I've noticed that the text output will append new lines to the start and end of the text being replaced.
Here is a simple script:
var mu = require('mu2');
mu.root = __dirname + '/templates';
mu.compileAndRender('test.html', {name: 'John'})
.on('data', function (data) {
console.log(data.toString());
});
templates/test.html is:
<h1>Hello {{name}}</h1>
The output is:
<h1>Hello
John
</h1>
instead of:
<h1>Hello John</h1>
I'm using node v0.8.4 and tried with both npm and github versions of mu2.
medatech commented
Okay, I'm being a numpty. The new lines are caused by the console.log being called multiple times.
Maybe the example on the project page could be a little clearer.