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

🐛 fix: fix antd cssvar mode in SSR #172

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [3.7.1-beta.1](https://github.com/ant-design/antd-style/compare/v3.7.0...v3.7.1-beta.1) (2024-10-22)

### 🐛 Bug Fixes

- Fix cssvar ([ac642b7](https://github.com/ant-design/antd-style/commit/ac642b7))

# [3.7.0](https://github.com/ant-design/antd-style/compare/v3.6.3...v3.7.0) (2024-09-28)

### ✨ Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "antd-style",
"version": "3.7.0",
"version": "3.7.1-beta.1",
"description": "css-in-js solution for application combine with antd v5 token system and emotion",
"keywords": [
"antd",
Expand Down
4 changes: 3 additions & 1 deletion src/functions/extractStaticStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ export const extractStaticStyle = (html?: string, options?: ExtractStyleOptions)
<style
key={'antd'}
data-antd-version={version}
data-rc-order="prepend"
data-rc-priority="-9999"
dangerouslySetInnerHTML={{ __html: antdCssString }}
/>
),
ids: Array.from(cache.cache.keys()),
key: 'antd',
css: antdCssString,
tag: `<style data-antd-version="${version}">${antdCssString}</style>`,
tag: `<style data-rc-order="prepend" data-rc-priority="-9999" data-antd-version="${version}">${antdCssString}</style>`,
};

// copy from emotion ssr
Expand Down
2 changes: 1 addition & 1 deletion tests/functions/extractStaticStyle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('extractStaticStyle', () => {
const item = result.find((i) => i.key === 'antd')!;
expect(item).toBeDefined();
expect(item.css).toMatch(/\.ant-/);
expect(item.tag).toMatch(/<style data-antd-version="[0-9]+\.[0-9]+\.[0-9]+">\s*/);
expect(item.tag).toMatch(/<style data-rc-order="prepend" data-rc-priority="-9999" data-antd-version="[0-9]+\.[0-9]+\.[0-9]+">\s*/);
});

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