Skip to content

Commit 610eef6

Browse files
committed
Add extractStyle API description to README
close #187 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ant-design/cssinjs?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 3a0664f commit 610eef6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,31 @@ Create theme object. When same algorithm provided, it will return same object.
7575

7676
Since `@ant-design/cssinjs` use strong constraints for cache hit performance, we recommend to view demo `basic.tsx` for usage and `animation.tsx` for animation usage.
7777

78+
### extractStyle
79+
80+
Extracts the styles from the cache and returns them as a string.
81+
82+
#### Parameters
83+
84+
- `cache` (Cache): The cache instance containing the styles.
85+
- `options` (object | boolean, optional): Options for extracting the styles.
86+
- `plain` (boolean, optional): If true, the styles will be returned in plain format. Default is false.
87+
- `types` (string | string[], optional): The types of styles to extract. Default is ['style', 'token', 'cssVar'].
88+
89+
#### Returns
90+
91+
- (string): The extracted styles as a string.
92+
93+
#### Example
94+
95+
```typescript
96+
import extractStyle from '@ant-design/cssinjs';
97+
98+
const cache = /* your cache instance */;
99+
const styles = extractStyle(cache, { plain: true, types: ['style', 'token'] });
100+
console.log(styles);
101+
```
102+
78103
## Transform
79104

80105
When you need transform CSSObject before inject style. You can use `transformers` to handle this:

0 commit comments

Comments
 (0)