Skip to content

antd 6.0.0烘焙丢失样式 .ant-modal-confirm所有样式未生成 #23

@jinxiangqiang

Description

@jinxiangqiang

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});

如图
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions