【发布时间】:2016-11-01 13:40:03
【问题描述】:
我有一个使用车把的 node/express 应用程序。
我正在尝试为车把安装此帮助程序。我是用npm安装的,文件都在那里。
如何在页面上使用它?我不确定我需要在哪里包含它。我在路由和 app.js 文件中都试过了。
error: Missing helper: "svg"
这是我想使用的路线:
router.get('/app', function(req, res, next) {
res.render('app/index', { title: 'My App', layout: false });
});
这是我要安装的助手:https://www.npmjs.com/package/handlebars-helper-svg
我发现的一切都是关于创建自己的助手,而不是加载其他人。
完全错误:
/home/ubuntu/workspace/views/project/index.hbs:缺少助手:“svg”
Error: /home/ubuntu/workspace/views/project/index.hbs: Missing helper: "svg"
at Object.<anonymous> (/home/ubuntu/workspace/node_modules/hbs/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
at Object.eval (eval at createFunctionContext (/home/ubuntu/workspace/node_modules/hbs/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:8:64)
at main (/home/ubuntu/workspace/node_modules/hbs/node_modules/handlebars/dist/cjs/handlebars/runtime.js:173:32)
at ret (/home/ubuntu/workspace/node_modules/hbs/node_modules/handlebars/dist/cjs/handlebars/runtime.js:176:12)
at ret (/home/ubuntu/workspace/node_modules/hbs/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:525:21)
at /home/ubuntu/workspace/node_modules/hbs/lib/hbs.js:63:19
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
app.js 文件:http://pastebin.com/Ge6NaDXc
【问题讨论】:
-
您没有提供任何关于如何添加车把来表达的信息。
标签: node.js express handlebars.js