【问题标题】:How to import and use materialize (or any other css library) sass in React如何在 React 中导入和使用 materialize(或任何其他 css 库)sass
【发布时间】:2020-02-03 21:16:29
【问题描述】:

我应该如何在使用 create-react-app 创建的 react 项目中正确使用 materialize Sass?我应该将 scss 和 js 文件保存在哪里?

我想如果我使用 sass,我不应该在我的 index.html 中导入缩小的 css 和 js 文件?

【问题讨论】:

    标签: css reactjs sass materialize


    【解决方案1】:

    3 个简单的步骤,一切就绪!

    1. 安装 node-sass (npm install node-sass)
    2. 如果您的具体化文件是 .css,请将其更改为 .scss
    3. 导入! (导入“./materialize.scss”;)

    更多信息:https://scotch.io/tutorials/using-sass-in-create-react-app-v2

    【讨论】:

      【解决方案2】:

      这里有一篇文章讨论了基于每个组件创建自定义 css 构建和导入 javascript:

      https://medium.com/@mattdlockyer/youre-using-materialize-css-wrong-470b593e78e9

      【讨论】:

        猜你喜欢
        • 2016-05-31
        • 1970-01-01
        • 2019-04-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-10-23
        • 2019-10-01
        • 2020-04-28
        相关资源
        最近更新 更多