【问题标题】:How to integrate React Bootstrap with Gatsby如何将 React Bootstrap 与 Gatsby 集成
【发布时间】:2019-08-31 14:58:45
【问题描述】:

我正在尝试将 react-bootstrap 框架与我的 Gatsby 项目集成,但我在控制台上出现以下错误,并且没有呈现任何内容。

我是通过npm包安装的"npm i react-bootstrap bootstrap --save" 并将其添加到 gatsby-browser.js 中: 导入“./node_modules/bootstrap/dist/css/bootstrap.css”;

enter image description here

【问题讨论】:

    标签: css reactjs gatsby


    【解决方案1】:

    不要使用 gatsby-browser.js,试试这种方式。

    在 Layout.js 中使用 main.scss

    import '../stylesheets/main.scss';
    

    然后在 main.scss 中从 node_modules 调用引导程序。

    @import '~bootstrap/scss/bootstrap';
    

    【讨论】:

      猜你喜欢
      • 2019-10-19
      • 2023-03-09
      • 1970-01-01
      • 2019-06-09
      • 2019-06-08
      • 2020-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多