Provide a lib like @ant-design/static-style-extract to support generate static css for SSR usage to generate raw css file for caching.
npm install @ant-design/static-style-extract
import extractStyle from `@ant-design/static-style-extract`;
const cssText = extractStyle(); // :where(.css-bAMboOo).ant-btn ...
use with custom theme
import extractStyle from `@ant-design/static-style-extract`;
const cssText = extractStyle(); // :where(.css-bAMboOo).ant-btn ...
const cssText = extractStyle((node) => (
<ConfigProvider theme={theme}>
{node}
</ConfigProvider>
));
online example: http://react-component.github.io/static-style-extract/
npm install
npm start
npm test
npm run coverage
open coverage/ dir
static-style-extract is released under the MIT license.