cuth / postcss-pxtorem

Convert pixel units to rem (root em) units using PostCSS
MIT License
2.02k stars 174 forks source link

"rootvalue" In the case of two designs, only one parameter can be set #100

Open declanchiu opened 1 year ago

declanchiu commented 1 year ago

how to set the root value for a web project that has both mobile and PC designs? The mobile design has a size of 375px and the PC design has a size of 1920px. I would greatly appreciate any guidance on how to approach this, or if there is a function that can help with this issue. Thank you very much.

pandavips commented 11 months ago

I think in this situation, you can store your PC and mobile files in separate directories, and then perform the necessary checks in the rootValue function to return the corresponding values. The rootValue can be a function that takes parameters for performing the required checks.

Of course, you are not obligated to follow my suggestion exactly. As long as you can come up with conditions that satisfy the differentiation within the function, it should work. I hope this helps you.