Skip to content

Instantly share code, notes, and snippets.

@polotek
Created December 21, 2012 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polotek/4351092 to your computer and use it in GitHub Desktop.
Save polotek/4351092 to your computer and use it in GitHub Desktop.
js+html for @getify
<!-- template_file.html -->
<div>
  <p class="title">{title}</p>
  <span class="timestamp">{created_date}</span>
</div>
Post({
 title: 'How to achieve SoC'
 , created_date: new Date(...)
 , render: function render() {
   return Template.render('template_file', this);
 }
});
Post({
 title: 'How to achieve SoC'
 , created_date: new Date(...)
 , template: '<div>\
   <p class="title">{title}</p>\
   <span class="timestamp">{created_date}</span>\
 </div>'
 , render: function render() {
   return Template.render(this.template, this);
 }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment