【问题标题】:How to implement react static scss into project?如何将反应静态 scss 实施到项目中?
【发布时间】:2020-02-03 20:11:51
【问题描述】:

我正在使用静态反应模板,需要实现 scss。我的 git hub 示例:https://github.com/PrasanthGokuldas/Test_ReactStatic.git 我尝试将 react-static-plugin-sass 添加到 package.json 并包含在 static.config.js 文件中

plugins: ['react-static-plugin-sass']

但我无法访问 scss 文件进行项目。

【问题讨论】:

    标签: reactjs server-side-rendering react-static


    【解决方案1】:

    使用 yarn 或 npm 添加 react-static-plugin-sass 后,您需要将其添加到插件数组 (static.config.js) 的顶部,如下所示:

    plugins: [
        require.resolve('react-static-plugin-sass'),
        [
            require.resolve('react-static-plugin-source-filesystem'),
            {
                location: path.resolve('./src/pages'),
            },
        ],
        require.resolve('react-static-plugin-reach-router'),
        require.resolve('react-static-plugin-sitemap'),
    ],
    

    然后你需要做的就是开始在你的 app.scss 文件中编写你的 Sass 并在你的 App.js 中导入 app.scss。

    【讨论】:

      猜你喜欢
      • 2020-03-08
      • 2022-09-22
      • 2017-08-22
      • 2022-08-02
      • 1970-01-01
      • 1970-01-01
      • 2017-07-29
      • 1970-01-01
      • 2014-10-16
      相关资源
      最近更新 更多