我使用的是 Handlebars 1.3.0。我尝试使用命令预编译 Handlebars 模板
handlebars aa.tpl -f aa.js
我得到下面给出的输出。在编译的 .js 文件中,源模板文件中不存在 html 标签。
(function() {
var template = Handlebars.template,
templates = Handlebars.templates = Handlebars.templates || {};
})();
该工具有什么问题吗?
最佳答案
我们必须在命令行中提及源文件的扩展名
handlebars --extension=tpl aa.tpl -f aa.js
关于javascript - handlebar.js 中的预编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21302717/