Express.js不让我使用Handlebars?

时间:2017-06-02 06:29:17

标签: javascript node.js express handlebars.js

我尝试使用Handlebars安装Express.js应用程序。我用这个命令安装它:

express beatwire --hbs

然而,每当我输入它时,它就会出现这个:

   create : beatwire
   create : beatwire/package.json
   create : beatwire/app.js
   create : beatwire/public
   create : beatwire/public/javascripts
   create : beatwire/public/images
   create : beatwire/public/stylesheets
   create : beatwire/public/stylesheets/style.css
   create : beatwire/routes
   create : beatwire/routes/index.js
   create : beatwire/routes/users.js
   create : beatwire/views
   create : beatwire/views/index.jade
   create : beatwire/views/layout.jade
   create : beatwire/views/error.jade
   create : beatwire/bin
   create : beatwire/bin/www

换句话说,它只让我使用Jade并且​​不让我使用Handlebars。我已经安装过5次Handlebars,但我不知道自己做错了什么。发生了什么事?

1 个答案:

答案 0 :(得分:0)

使用快速生成器来支持您的应用程序,如下所示:

express beatwire --view=hbs

您应该获得以下输出:

 ~/Documents  => express beatwire --view=hbs

   create : beatwire
   create : beatwire/package.json
   create : beatwire/app.js
   create : beatwire/public
   create : beatwire/routes
   create : beatwire/routes/index.js
   create : beatwire/routes/users.js
   create : beatwire/public/javascripts
   create : beatwire/public/images
   create : beatwire/views
   create : beatwire/views/index.hbs
   create : beatwire/views/layout.hbs
   create : beatwire/views/error.hbs
   create : beatwire/public/stylesheets
   create : beatwire/public/stylesheets/style.css
   create : beatwire/bin
   create : beatwire/bin/www

   install dependencies:
     $ cd beatwire && npm install

   run the app:
     $ DEBUG=beatwire:* npm start

如果你试图同时做到这两点,你会得到这个:

  

警告:选项--hbs' has been renamed to - view = hbs'