Skip to content

Instantly share code, notes, and snippets.

@fpoirier1
Created June 11, 2014 18:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fpoirier1/534bf5db69ece2c83205 to your computer and use it in GitHub Desktop.
Save fpoirier1/534bf5db69ece2c83205 to your computer and use it in GitHub Desktop.
Render template on server with UnderscoreJS
<!-- private/email-template.html -->
<div>Welcome {{name}}</div>
//server/template.js
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
};
function renderEmailTemplate(){
var template = Assets.getText("email-template.html");
templateCompiled = _.template(template);
return templateCompiled({'name' : 'Francis'}))
}
@hsribei
Copy link

hsribei commented Aug 29, 2014

Worked perfectly. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment