ant-design / cssinjs

https://ant-design.github.io/cssinjs
MIT License
235 stars 57 forks source link

feat(transformer): px2rem supports more options #174

Open hemengke1997 opened 4 months ago

hemengke1997 commented 4 months ago

antd团队你们好,这个pr主要同步了 pxtorem@minko-fe/pxtorem 的部分逻辑

新增了一些配置项:

  1. minPixelValue,设置最小转化的px大小
  2. propList,设置可转化为rem的css属性
  3. selectorBlackList: { match, deep },黑名单相关,match用于匹配className;deep用于控制是否深度黑名单,若为true,则匹配到的类及其子类都会列入黑名单
  4. convertUnit,其目的用于转化 PX、Px 这种不规范的单位至px(并不会转rem)

由于其他的transformer都把逻辑写在同一文件中,所以此处也没有拆分代码 命名、代码风格等可能不符合antd团队规范,若有任何问题,请随意修改,谢谢!

socket-security[bot] commented 4 months ago

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/defu@6.1.4 None 0 19.6 kB pi0

View full report↗︎

codecov-commenter commented 4 months ago

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (907a22b) 94.80% compared to head (fb860ef) 94.86%.

:exclamation: Current head fb860ef differs from pull request most recent head 5c22fda. Consider uploading reports for the commit 5c22fda to get more accurate results

Files Patch % Lines
src/transformers/px2rem.ts 95.89% 8 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #174 +/- ## ========================================== + Coverage 94.80% 94.86% +0.05% ========================================== Files 29 29 Lines 2619 2862 +243 Branches 394 459 +65 ========================================== + Hits 2483 2715 +232 - Misses 136 144 +8 - Partials 0 3 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hemengke1997 commented 2 months ago

请问有考虑合并吗~