-
Notifications
You must be signed in to change notification settings - Fork 79
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(px2rem): support nesting_selector #1064
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe changes in this update aimed to enhance the CSS selector support in the Changes
Poem
Note Pull Request Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai Files selected for processing (1)
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 Configration File (
|
assert_eq!( | ||
run( | ||
r#".a .b{width:100px;}"#, | ||
Px2RemConfig { |
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.
用 Default::default()
或者 Px2RemConifg::default()
更加简洁
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.
收到 确实是这样更简洁
建议看下这个部分 https://swc.rs/docs/plugin/ecmascript/cheatsheet#make-your-handlers-stateless
current_decl 的记录是有问题的 |
@@ -173,6 +186,28 @@ fn parse_compound_selector(selector: &CompoundSelector) -> String { | |||
result | |||
} | |||
|
|||
fn parse_attribute(attr: &AttributeSelector) -> String { |
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.
一般来说把"文本"变成对应的抽象数据结构叫 parse,这里是抽象数据结构到 String 不应该叫 parse
xxx_to_string 应该更合适一点。
另外看看 AttributeSelector 是不是已经有 trait 可以直接转换成 string 的
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.
通过 span 到 CM 取出片段我觉得是更加合理的实现
self.context.meta.css.cm.span_to_source()
# Conflicts: # crates/mako/src/visitors/css_px2rem.rs
场景可能暂用不到,这个 pr 先 hold 不合。 |
支持nesting_selector
Summary by CodeRabbit