1
在我的assemblefile.js中,我尝试注册一个自定义帮助程序。这个帮手本身确实有用,因为我已经在使用汇编的咕噜声项目中使用它了。如何在汇编中注册自定义handelbars助手0.17.1
assemble: {
options: {
helpers: ['./src/helper/custom-helper.js' ]
}
}
在汇编0.17.1我试过这样但它不起作用。有谁知道如何做到这一点?
app.helpers('./src/helper/custom-helper.js');
定制helper.js:
module.exports.register = function (Handlebars, options, params) {
Handlebars.registerHelper('section', function(name, options) {
if (!this.sections) {
this.sections = {};
}
this.sections[name] = options.fn(this);
return null;;
});
};
非常感谢。有用!!! – Majabee