将CSS从React CSS模块中提取到专用CSS文件中

问题描述

我们正在使用Laravel和Laravel Mix进行JavaScript开发。对于我们的前端,我们将React与CSS模块一起使用。 来自我们组件的CSS已通过许多样式标签连接到html的头部。 是否可以将我们组件的CSS提取到专用的CSS文件中,而不用使用很多样式标签?

样品成分

import Container from "../Container";
import styles from "./style.module.scss";

const HeroContainer = ({ children }) => {
    return (
        <Container
            desktopFullWidth
            className={`hero-container ${styles.container}`}
        >
            <div className={styles.contentWrapper}>{children}</div>
        </Container>
    );
};

export default HeroContainer;

它出现在我们脑海中的方式

<style type="text/css">.style-module__radioButton___nHaYb {
  width: 10px;
  height: 10px;
}</style>

那是我们的weback.mix.json

mix.js("resources/js/app.js","public/js")
    .extract(["react","react-dom","react-router-dom","react-datepicker"])
    .reactCSSModules();
mix.sass("resources/sass/app.scss","public/css");

提前谢谢!

亚历克斯

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...