jsbin/lib/hbs.js
Remy Sharp 5f278a8db6 Merge branch 'master' into feature/upgrade
Conflicts:
	lib/features.js
2014-06-20 16:10:38 +01:00

33 lines
806 B
JavaScript

'use strict';
var hbs = require('hbs'),
features = require('./features'),
path = require('path');
hbs.registerPartials(path.resolve(__dirname + '/../views/partials'));
hbs.registerHelper('feature', function(request, flag, options) {
if (features(flag, request)) {
return options.fn(this);
} else if (options.inverse) {
return options.inverse(this);
}
});
hbs.registerHelper('equal', function(lvalue, rvalue, options) {
if (arguments.length < 3) {
return false;
}
if (lvalue !== rvalue) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
hbs.registerHelper('dump', function(obj) {
return JSON.stringify(obj, null, 2);
});
hbs.registerPartial('welcome_panel', __dirname + '/../views/partials/welcome-panel.html');
module.exports = hbs;