Skip to content

Instantly share code, notes, and snippets.

@yannickcr
Created June 5, 2013 09:41
Show Gist options
  • Save yannickcr/5712791 to your computer and use it in GitHub Desktop.
Save yannickcr/5712791 to your computer and use it in GitHub Desktop.
Handlebars Set Helper: Capture a block of content and store it in a variable.
/*
* Usages:
* {{#set "content"}}
* captured content
* {{/set}}
* My {{ content }}
*/
Handlebars.registerHelper('set', function(name, options) {
this[name] = options.fn(this);
return null;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment