Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Handlebars Grunt: Using grunt-render in handlebars templates https://github.com/makesites/grunt-render/
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"){
options.name = 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.