Skip to content

Commit e79a0fd

Browse files
authored
🐛 fix: fix antd cssvar mode in SSR (#172)
1 parent 0561b1b commit e79a0fd

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [3.7.1-beta.1](https://github.com/ant-design/antd-style/compare/v3.7.0...v3.7.1-beta.1) (2024-10-22)
4+
5+
### 🐛 Bug Fixes
6+
7+
- Fix cssvar ([ac642b7](https://github.com/ant-design/antd-style/commit/ac642b7))
8+
39
# [3.7.0](https://github.com/ant-design/antd-style/compare/v3.6.3...v3.7.0) (2024-09-28)
410

511
### ✨ Features

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "antd-style",
3-
"version": "3.7.0",
3+
"version": "3.7.1-beta.1",
44
"description": "css-in-js solution for application combine with antd v5 token system and emotion",
55
"keywords": [
66
"antd",

src/functions/extractStaticStyle.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ export const extractStaticStyle = (html?: string, options?: ExtractStyleOptions)
7171
<style
7272
key={'antd'}
7373
data-antd-version={version}
74+
data-rc-order="prepend"
75+
data-rc-priority="-9999"
7476
dangerouslySetInnerHTML={{ __html: antdCssString }}
7577
/>
7678
),
7779
ids: Array.from(cache.cache.keys()),
7880
key: 'antd',
7981
css: antdCssString,
80-
tag: `<style data-antd-version="${version}">${antdCssString}</style>`,
82+
tag: `<style data-rc-order="prepend" data-rc-priority="-9999" data-antd-version="${version}">${antdCssString}</style>`,
8183
};
8284

8385
// copy from emotion ssr

tests/functions/extractStaticStyle.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('extractStaticStyle', () => {
5353
const item = result.find((i) => i.key === 'antd')!;
5454
expect(item).toBeDefined();
5555
expect(item.css).toMatch(/\.ant-/);
56-
expect(item.tag).toMatch(/<style data-antd-version="[0-9]+\.[0-9]+\.[0-9]+">\s*/);
56+
expect(item.tag).toMatch(/<style data-rc-order="prepend" data-rc-priority="-9999" data-antd-version="[0-9]+\.[0-9]+\.[0-9]+">\s*/);
5757
});
5858

5959
// FIXME: 迁移到 vitest 后,不知道为什么 无法提取 extractStaticStyle 了

0 commit comments

Comments
 (0)