0
我使用咕嚕編譯車把編譯我的車把和我有問題,該@root
對象改變我用把手幫手:編譯模板,並保持@root
[...]
handlebars.compile(template);
template(context.data);
[...]
所以,當我的JSON之後對象是類似的東西
{
"template": "path/to/template",
"data": {
"greetings": {...}
}
}
這總是我的@root
對象。
我有類似:
var handlebars = require('../../node_modules/grunt-compile-handlebars/node_modules/handlebars') ;
module.exports = function(context) {
var template = handlebars.partials[context.template];
template = handlebars.compile(template);
return new handlebars.SafeString(template(context.data));
};
{{helper .}}
現在我@root
對象是:
"data": {
"greetings": {...}
}
有沒有一種方法可以讓我保持@root
打電話時template(...)
注:這是一個非常簡單的例子。我知道,我還可以使用{{>path/to/template .}}