ant-design / antd-style

css-in-js library with antd v5 token system

Home Page:https://ant-design.github.io/antd-style/

Repository from Github https://github.comant-design/antd-styleRepository from Github https://github.comant-design/antd-style

🧐[问题] 如何导出 createStyles 创建的 css 样式文本

liuweiGL opened this issue · comments

🧐 问题描述

我在使用 Lexical 富文本做模板编辑器,需要把富文本的 html 片段给后端转换成 pdf。
现在的问题是如何把 createStyles 定义的样式转换成 css 文本给后端使用。
即如何根据以下样式定义

export const useBaseStyles = createStyles(({ token }) => ({
  paragraph: {
    position: 'relative',
    margin: 0
  }
})

获取到对应的 css 文本

.acss-x4x53h {
    position: relative;
    margin: 0;
}

Image

💻 示例代码

🚑 其他信息

使用 StyleProvider 的 getStyleManager 可以获取到已注册的 css 列表