I assume this is due to the code in render-template.es6:
import _ from 'lodash';
import assert from 'assert';
export default function renderTemplate(template, data) {
var result = template;
// interpolate string
for (let [k,v] of _.pairs(data)) {
result = result.replace(`#{${k}}`, v)
}
// check if not all variables are filled
let freeVariables = result.match(/#\{(\S+)\}/g);
assert(!freeVariables, `template has unresolved variables:\ntemplate: ${template}\nmissing variables: ${(freeVariables || []).join(', ')}`);
return result;
}
I assume this is due to the code in
render-template.es6
:For example, I use this in my email template:
This will trip returning:
missing variables: #{serviceUrl}
.Possible to fix (or do we consider using a template rendering package)?