Skip to content

Instantly share code, notes, and snippets.

@Pablo-Merino
Last active August 29, 2015 14:17
Show Gist options
  • Save Pablo-Merino/4f49873b621a23be019d to your computer and use it in GitHub Desktop.
Save Pablo-Merino/4f49873b621a23be019d to your computer and use it in GitHub Desktop.
MiniTemplateEngine
function MiniTemplateEngine(base, replaceables) {
Object.keys(replaceables).forEach(function (key) {
var value = replaceables[key];
base = base.replace(new RegExp('{{' + key+ '}}', 'gi'), value);
});
return base;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment