React创建应用程序生产构建和IE11中的CSS变量
我想知道如何在生产版本中删除 CSS 变量。事实上,我需要为 IE11 构建一个不支持 CSS 变量的项目。我的项目是使用 React Create App 创建的,我无法执行 npm run pop。如何设置生产版本,以便在样式的初始心率中而不是变量,而是它们的值?
不要提供 css-vars-ponyfill
,在 IE11 中加载页面需要很长时间。
I would like to know how to get rid of CSS variables in a production build. The fact is that I need to build a project for IE11 in which CSS variables are not supported. My project was created using React Create App and I can't do npm run eject. How can you set up a production build so that in the initial heart rate of the style, instead of variables, there would be their values?
Don't offer css-vars-ponyfill
, it takes a very long time to load a page in IE11.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让 CSS 变量在 IE 中工作的唯一方法是使用 polyfill。如果您不想使用 css-vars-ponyfill,可以尝试 ie11CustomProperties 或 css-variables-polyfill。
如果你不想使用polyfill,我认为你只能手动编辑CSS样式来添加CSS后备来支持IE11。像这样的事情:
The only way to make CSS variables work in IE is using a polyfill. If you don't want to use css-vars-ponyfill, you can try ie11CustomProperties or css-variables-polyfill.
If you don't want to use a polyfill, I think you can only edit the CSS styles manually to add CSS fallbacks to support IE11. Something like this: