【发布时间】:2017-05-23 04:38:07
【问题描述】:
在 index.html 中,如下所示,我试图链接到位于 node_modules 文件夹中的 bootstrap.css,但出现错误。
应用的文件夹结构:
电子商务应用程序/节点模块
电子商务应用程序/src/app/index.html
在 index.html 中,以下所有对 bootstrap.css 的引用都会产生错误:
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.css">
这是错误: 获取http://localhost:3000/node_modules/bootstrap/dist/css/bootstrap.css 没有找到
【问题讨论】:
-
检查它们是否不在
assets文件夹中。如:assets/css/bootstrap.min.css -
bootstrap.css 肯定在 node_module 文件夹中,如上面的链接所示。我在资产 ecommerce.css 中有一个文件,它的链接可以正常工作:
-
你在使用 Angular-CLI 吗?
-
我在 Angular-CLI 中遇到了同样的问题。
标签: html twitter-bootstrap angular