在我的 assemblefile.js 中,我尝试注册一个自定义助手。助手本身确实有效,因为我在一个带有 assemble 的 grunt 项目中使用了它。
assemble: {
options: {
helpers: ['./src/helper/custom-helper.js' ]
}
}
在 assemble 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;;
});
};