Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Handlebars Grunt: Using grunt-render in handlebars templates
hbs.registerHelper('grunt', function(type, name) {
var options = {};
// fallbacks...
// if there is no type, exit now
if(typeof type == "undefined") return;
options.type = type;
// fallback for name
if(typeof name == "string"){ = name;
// fn will compile the body section between the tags
var files = arguments[arguments.length-1].fn || false;
if( files ){
options.files = files();
// remove last (internal) argument
//var options = arguments;
//delete options[arguments.length-1];
var grunt = require('grunt-render')( options );
var html = grunt[type]( options );
return new hbs.SafeString( html );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.