【问题标题】:index.html does not include links on browserindex.html 不包含浏览器上的链接
【发布时间】:2020-03-17 18:02:35
【问题描述】:

您好,在我的 react js 项目中,我包含了 blueprint.js 库的 <link> ,但浏览器无法识别它们。相反,我将它们导入index.js 文件然后它可以工作。有人可以简要解释一下为什么浏览器无法识别它们吗?

index.html

<link rel="stylesheet" type="text/css" href="./src/index.css" />
<!-- add other blueprint-*.css files here -->
<link href="./node_modules/normalize.css/normalize.css" rel="stylesheet" />
<!-- blueprint-icons.css file must be included alongside blueprint.css! -->
<link href="./node_modules/@blueprintjs/icons/lib/css/blueprint-icons.css" rel="stylesheet" />
<link href="./node_modules/@blueprintjs/core/lib/css/blueprint.css" rel="stylesheet"/>

index.js

import 'normalize.css'
import '@blueprintjs/core/lib/css/blueprint.css'
import '@blueprintjs/icons/lib/css/blueprint-icons.css';

当我注释掉我的导入时 index.js 网络浏览器不包括 links 为什么?

【问题讨论】:

    标签: reactjs blueprint


    【解决方案1】:

    node_modules 不会在您 build 您的项目时存在,因此它超出了范围。您只能从 index.html 中引用 public 文件夹内或外部(如 CDN)中的内容

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-06
      • 1970-01-01
      • 2023-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-08
      相关资源
      最近更新 更多