ant-design / antd-style

css-in-js library with antd v5 token system
https://ant-design.github.io/antd-style/
MIT License
187 stars 29 forks source link

🧐[问题] 迁移过程中 less语法中使用到的 :global 怎么处理 #72

Closed consistent-k closed 1 year ago

consistent-k commented 1 year ago

🧐 问题描述

迁移过程中 less语法中使用到的 :global 怎么处理,之前有部分场景需要通过:global 去覆盖组件样式,迁移过程中这部分代码如何处理。

💻 示例代码

:global(.ant-btn-link) { padding: 0px; font-size: 12px; }

🚑 其他信息

antd4 & umi4

arvinxx commented 1 year ago

去掉:global 就好了

a:css`
.ant-btn-link {
padding: 0px;
font-size: 12px;
}
`,

b:css({
  '.ant-btn-link': {
     padding: 0,
     fontSize: 12   
  }
})
arvinxx commented 1 year ago

另外可以使用 codemod 一键迁移:https://ant-design.github.io/antd-style/guide/migrate-less-codemod