-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
refactor(style): migrate from @functions to @plugin usage #8552
Conversation
This preview will be available after the AzureCI is passed. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8552 +/- ##
==========================================
- Coverage 91.58% 91.57% -0.02%
==========================================
Files 532 532
Lines 18334 18334
Branches 2802 2802
==========================================
- Hits 16791 16789 -2
- Misses 1226 1227 +1
- Partials 317 318 +1 ☔ View full report in Codecov by Sentry. |
3e3a391
to
df56cdb
Compare
df56cdb
to
dc165b8
Compare
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.
LGTM. I'll try to configure the codefactor settings to ignore tinycolor2.js
hi @HyperLife1119 reproduction link -> https://github.com/Laffery/nz-theme-issue 在 https://github.com/Laffery/nz-theme-issue/blob/main/src/app/pages/welcome/welcome.component.less#L10 中使用了zorro 内置变量 断点调试定位到抛错位置在 https://github.com/less/less.js/blob/master/packages/less/src/less/functions/color.js#L435 如果有时间请看下这个问题,期待和你一起探讨! |
我试了一下,看起来似乎是因为在 mixin 内部使用 import,会影响在外部使用 antd 内置的几个 @plugins(可能与插件的作用域有关),我在顶部添加一个 colorPalette.less 的导入就可以解决这个问题了: @import '../../../node_modules/ng-zorro-antd/src/style/color/colorPalette.less';
.themeMixin(@rules) {
html {
&.default {
@import './default.less';
@rules();
}
&.dark {
@import './dark.less';
@rules();
}
}
}
或者说必须在顶部导入 antd 的某个 theme,它们已经包含了那几个 plugins,或者直接在顶部导入 plugin 对应的 less 文件。🧐 |
动态主题场景下可能不太会在顶部就导入某个 theme,目前看最好就是在顶部导入 plugin。 |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
此 PR 基于 #8545.
由于 ZORRO 已经同步了最新的 antd4 的样式,并且 antd4 已进入维护模式,因此我们在这里直接修改 antd 的样式文件应该是被允许的。
在此 PR 中,我们将所有废弃的
@functions
语法替换为@plugin
,并且关闭 less 的 javascriptEnabled 选项,消除了编译警告。Does this PR introduce a breaking change?
由于
@functions
改为了@plugin
,在使用这些函数时,不再需要使用 ~` ` 语法对函数调用进行包裹,迁移方法为:旧用法:
新用法:
注意:我们需要在 v18 发行日志中提及这一点。
Other information