如何使用handlebarsjs渲染Boostrap模板

时间:2018-05-03 21:21:32

标签: jquery node.js express handlebars.js bootstrap-4

您好我正在尝试使用把手渲染自举模板(我使用Express作为服务器),它只是没有正确渲染,旋转木马滑块和Navbar徽标是根本没有渲染。

  

PS:我添加了Bootstrap所需的所有依赖项   4 / jquery的/爆米花..

1 个答案:

答案 0 :(得分:0)

如果您不知道如何正确配置webpack以构建package.json前端依赖项,只需直接在 .hbs 文件中使用它们即可。像这样:

<!doctype html>
<html lang="en">
  <head>

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">

  </head>
  <body>

    <h1>{{title}}</h1>


    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>

  </body>
</html>