首页 > 解决方案 > 无法在 VS Code 中链接我的 CSS Bootstrap 文件

问题描述

我无法在 VS Code 中将我的引导文件链接到我的 HTML,因为我已经链接了它,所以它不起作用。

在此处输入图像描述

标签: cssangularvisual-studio-codebootstrap-4

解决方案


如果这是一个 angular-cli 项目,并且您想在整个项目中使用引导程序,正确的方法是通过 npm 安装它,例如:

npm install bootstrap --save

然后确保文件引用位于样式和脚本下的 angular-cli.json 文件中:

  "styles": [
    "../node_modules/bootstrap/scss/bootstrap.css",
    ....
    ...
    "styles.css"
  ],
  "scripts": [
    "../node_modules/bootstrap/dist/js/bootstrap.bundle.js"
    ....
    ..
  ],

推荐阅读