Skip to content
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

support styled_components_plugin #896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

goo-yyh
Copy link
Contributor

@goo-yyh goo-yyh commented Jan 26, 2024

image
加上namespace后,功能验证正常。

遗留问题:

  1. 在mako.config.json里的值使用空对象 {} 时候, 解析完的 config 还是会按照默认的false, 如果对象中有 key, value 时,才会按照正常对象解析。类似于 styled_components, 由于每个值都设置了默认值,所以期望是 {} 时,也应该按照对象类型去解析。

@zhangpanweb
Copy link
Contributor

  1. 在mako.config.json里的值使用空对象 {} 时候, 解析完的 config 还是会按照默认的false, 如果对象中有 key, value 时,才会按照正常对象解析。类似于 styled_components, 由于每个值都设置了默认值,所以期望是 {} 时,也应该按照对象类型去解析。

一个解决方式是, DEFAULT_CONFIG 不配置 "styledComponents": false, ,然后给 styled_components 加一个 none_by_default 的默认值

 #[serde(
      rename = "styledComponents",
      deserialize_with = "deserialize_styled_components",
      default = "none_by_default"
  )]
  pub styled_components: Option<StyledComponentsConfig>,

Copy link
Member

@sorrycc sorrycc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1、参考 emotion 的方式增加一个 e2e 用例
2、补充配置到 config.md 里

@PeachScript
Copy link
Member

PeachScript commented Jan 29, 2024

  1. 在mako.config.json里的值使用空对象 {} 时候, 解析完的 config 还是会按照默认的false

@goo-yyh 这个问题看看我这个 PR 描述里提到的解法,之前也踩了一次坑:#837

补:噢其实就是 @zhangpanweb 提到的方式

@stormslowly stormslowly deleted the feat/lyy_styled_component_0123 branch March 25, 2024 05:24
@stormslowly stormslowly restored the feat/lyy_styled_component_0123 branch March 25, 2024 05:40
@stormslowly stormslowly reopened this Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants