-
Notifications
You must be signed in to change notification settings - Fork 5
Description
import { extractStyle } from '@ant-design/static-style-extract';
import { ConfigProvider, theme } from 'antd';
import * as React from 'react';
import { antdConfig } from 'xxx';
import { StyleProvider } from '@ant-design/cssinjs';
import * as fs from 'fs';
import * as path from 'path';
const cssText = extractStyle((node) => <StyleProvider hashPriority={'high'}><ConfigProvider prefixCls={'ant'} theme={{ algorithm: theme.darkAlgorithm, ...antdConfig.configProvider.theme }} componentSize={'small'}>{node});
const targetPath = path.join(__dirname, '../packages/xxx/assets/css/antd.min.css');
const targetDir = path.dirname(targetPath);
// 确保目录存在
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });
}
// 写入文件
fs.writeFileSync(targetPath, cssText, 'utf-8');
console.log(CSS 已写入: ${targetPath});
