How do I precompile partials for handlebars.js?

后端 未结 7 1259
心在旅途
心在旅途 2021-02-01 03:10

I\'m using handlebars.js and I want to start precompiling everything, but I can\'t seem to find a way to precompile the partials. The majority of my templates are actually parti

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 03:56

    for(let [name, template] of Object.entries(handlebars.partials)) {
        handlebars.partials[name] = handlebars.compile(template);
    }
    

提交回复
热议问题