Skip to content

Instantly share code, notes, and snippets.

@i-like-robots
Created June 18, 2013 08:43
Show Gist options
  • Save i-like-robots/5803698 to your computer and use it in GitHub Desktop.
Save i-like-robots/5803698 to your computer and use it in GitHub Desktop.
Handlebars helper to repeat a chunk of encapsulated output an arbitrary number of times.
// {{#loop 12}}
// <output>
// {{/loop}}
handlebars.registerHelper('loop', function(count, options) {
var out = "";
while (count--) {
out+= options.fn();
}
return out;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment