hbs-helper
Version:
handlebar template engine's helper
24 lines (23 loc) • 609 B
JavaScript
module.exports= function(hbs){
hbs.registerHelper('gridValueKey', function (options) {
var args = [].slice.apply(arguments);
var length = 0;
var string;
for(var i = 0; i < args.length -1; ++i) {
if (arguments[i]) {
length += 1;
}
}
// console.log(length)
if (length == 1) {
string = "col-md-12 sm-col-12";
} else if (length == 2) {
string = "col-md-6 sm-col-6";
} else if (length == 3) {
string = "col-md-4 sm-col-6";
} else if (length >= 4) {
string = "col-md-3 sm-col-6";
}
return string;
});
}