-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: change px2rem regex config #1469
Conversation
Caution Review failedThe pull request is closed. Walkthrough此次更改主要集中在 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Config
User->>Config: 提交选择器配置
Config->>Config: 解析选择器模式
alt 选择器以斜杠包围
Config->>Config: 识别为正则表达式
else 选择器未包围
Config->>Config: 格式化为字符串匹配
end
Config->>User: 返回解析结果
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- crates/mako/src/visitors/css_px2rem.rs (8 hunks)
- docs/config.md (1 hunks)
- docs/config.zh-CN.md (1 hunks)
Additional comments not posted (4)
docs/config.zh-CN.md (1)
566-573
: 文档更新:解释正则表达式和字符串的用法文档清楚地解释了
selectorBlackList
、selectorWhiteList
和selectorDoubleList
属性可以接受正则表达式或字符串,并提供了示例。这有助于用户更好地理解和使用这些配置项。docs/config.md (1)
566-573
: Documentation Update: Clarification on Regex and String UsageThe documentation clearly explains that the
selectorBlackList
,selectorWhiteList
, andselectorDoubleList
properties can accept regular expressions or strings, and provides an example. This helps users better understand and use these configuration items.crates/mako/src/visitors/css_px2rem.rs (2)
149-150
: 简化正则表达式解析逻辑正则表达式解析逻辑被简化为仅检查模式是否以斜杠开头和结尾。这种方法更直观,但需要确保所有模式都符合这种格式。
Line range hint
409-665
: 更新测试用例以匹配新的正则表达式格式测试用例已更新,以确保新的正则表达式格式得到正确验证。这些更改确保了配置的灵活性和清晰度。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- docs/config.md (1 hunks)
- docs/config.zh-CN.md (1 hunks)
Additional comments not posted (2)
docs/config.zh-CN.md (1)
577-584
: 文档更新清晰且准确。对
selectorBlackList
、selectorWhiteList
和selectorDoubleList
的解释清晰,示例也正确地展示了如何使用正则表达式和字符串。docs/config.md (1)
577-584
: Documentation update is clear and accurate.The explanation of
selectorBlackList
,selectorWhiteList
, andselectorDoubleList
is clear, and the example correctly demonstrates how to use regular expressions and strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bundler-mako
层可以做一次转换?把正则转成字符串,这样 Umi 应用就不用改了
@PeachScript Umi 应用没有直接对应的配置吧? |
Umi 有 |
在 bigfish 里面应该也是内置了 postcss-plugin-px2rem 插件,在 umi 里面应该是没有 |
修改 px2rem 的配置解析,对标
postcss-plugin-px2rem
的现有配置postcss-plugin-px2rem
配置['.a',/.adm-/, /^:root/, /._CustomClass/]修改前 mako px2rem 配置 [".a","(.adm-)","^:root","(._CustomClass)"]
修改后 mako px2rem 配置[".a","/.adm-/", "/^:root/", "/._CustomClass/"]
修改后只需把之前的正则表达式当作字符串传递即可,减少项目迁移成本。
Summary by CodeRabbit
新特性
selectorBlackList
、selectorWhiteList
和selectorDoubleList
属性的行为,用户可以使用字符串或正则表达式。文档