Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[All] 使用postcss-pxtorem无法将px转换为rem #1278

Open
2435724045 opened this issue Mar 26, 2024 · 2 comments
Open

[All] 使用postcss-pxtorem无法将px转换为rem #1278

2435724045 opened this issue Mar 26, 2024 · 2 comments

Comments

@2435724045
Copy link

这个功能解决了什么问题

您好!主要是询问下ui组件库在引入后,vite项目配置了将px转换为rem的插件后,标签class中的px属性值按理说应该可以被转换为rem单位的,但却没有被转换,一直没有好的解决办法,参考了vant的,没对比出来样式文件上有什么区别
,所以求助下

68355B94-C866-4535-9A07-026DF0125522
9074F0AC-99E9-4bec-BD66-2DFD5BBDE593

你建议的方案是什么

希望可以被转换到

Copy link
Contributor

👋 @2435724045,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@2435724045
Copy link
Author

经过一番研究后,发现是由于css var函数嵌套导致 postcss-pxtorem 插件没有对此进行转换导致的,已通过postcss-custom-properties 插件对此嵌套进行前置计算得到一个最终的普通值,这样就会正常转换了。

⚠⚠这样处理后,还是有一些组件无法支持到。
例如loading等svg部分的单位依然是非rem值,当手动设置px且被插件转换为rem后,电脑端的浏览器手机模拟和在手机浏览器上的展示效果又不一致了,希望可以得到官方的支持和改善

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant