CSS自定义属性在React生产构建中不起作用

发布于 2025-02-02 02:10:49 字数 555 浏览 2 评论 0原文

我有几个自定义的CSS属性在根上定义了,并且它们在开发构建方面工作正常,但是它们在生产构建中没有加载。 自定义属性是在index.css中定义的。

:root {
  --light-theme-background-color: #fafafa;
  --light-theme-text-color: #333;
  --light-theme-active-color: #cbcbcb;
  --dark-theme-background-color: #1d2327;
  --dark-theme-text-color: #227093;
  --dark-theme-active-color: #343434;
}

在开发工具中,自定义属性是灰色的,当我徘徊时,我会收到未定义它们的消息。

I have several custom css properties defined on the root, and they are working fine on the development build, however they aren't loading on the production build.
The custom properties are defined in index.css.

:root {
  --light-theme-background-color: #fafafa;
  --light-theme-text-color: #333;
  --light-theme-active-color: #cbcbcb;
  --dark-theme-background-color: #1d2327;
  --dark-theme-text-color: #227093;
  --dark-theme-active-color: #343434;
}

enter image description here

In the dev tools the custom properties are grayed out and when I hover I get the message that they are not defined.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文