Skip to content

Commit

Permalink
🐛 fix: fix antd cssvar mode in SSR (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Oct 22, 2024
1 parent 0561b1b commit e79a0fd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
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

0 comments on commit e79a0fd

Please sign in to comment.