cssinjs icon indicating copy to clipboard operation
cssinjs copied to clipboard

feat(transformer): px2rem supports more options

Open hemengke1997 opened this issue 2 years ago • 3 comments

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团队规范,若有任何问题,请随意修改,谢谢!

hemengke1997 avatar Feb 05 '24 16:02 hemengke1997

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

Package New capabilities Transitives Size Publisher
npm/[email protected] None 0 19.6 kB pi0

View full report↗︎

socket-security[bot] avatar Feb 05 '24 16:02 socket-security[bot]

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
@@            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.

codecov-commenter avatar Feb 06 '24 02:02 codecov-commenter

请问有考虑合并吗~

hemengke1997 avatar Apr 30 '24 08:04 hemengke1997