如何将一个车把js文件包含到另一个?

时间:2015-09-02 05:14:29

标签: node.js handlebars.js

我不熟悉使用Nodejs的车把诱惑。我想将2个车把文件合并为一个。所以经过一番谷歌搜索我试过这个

layout.hbs

<!DOCTYPE html>
<html>
  <head>
    <title>{{title}}</title>
    <link rel='stylesheet' href='/stylesheets/bootstrap.css' />
    <link rel='stylesheet' href='/stylesheets/base.css' />
  </head>
  <body>
    {{> header}}
    {{{body}}}
    {{> footer}}
  </body>
</html>

heaeder.hbs

<p>I am header</p>

footer.hbs

<p>I am footer</p>

我的文件夹结构是

的观点 - layout.hbs - header.hbs - footer.hbs

但这不起作用我收到此错误

Error
   at Object.<anonymous> (C:\SVN HOME 2\YASSER\One-Bitbucket\node_modules\hbs\node_modules\handlebars\dist\cjs\handlebars\exception.js:29:23)
   at Module._compile (module.js:460:26)
   at Object.Module._extensions..js (module.js:478:10)
   at Module.load (module.js:355:32)
   at Function.Module._load (module.js:310:12)
   at Module.require (module.js:365:17)
   at require (module.js:384:17)
   at Object.<anonymous> (C:\SVN HOME 2\YASSER\One-Bitbucket\node_modules\hbs\node_modules\handlebars\dist\cjs\handlebars\base.js:3:17)
   at Module._compile (module.js:460:26)
   at Object.Module._extensions..js (module.js:478:10)
   at Module.load (module.js:355:32)
   at Function.Module._load (module.js:310:12)
   at Module.require (module.js:365:17)
   at require (module.js:384:17)
   at Object.<anonymous> (C:\SVN HOME 2\YASSER\One-Bitbucket\node_modules\hbs\node_modules\handlebars\dist\cjs\handlebars.runtime.js:3:12)
   at Module._compile (module.js:460:26)

关于它是如何工作的任何想法?

0 个答案:

没有答案