Skip to content

Commit e24a005

Browse files
committed
docs(plugin): improve plugin docs
1 parent cd02093 commit e24a005

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/docs/guide/advances/plugin.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
`vue-styled-components` supports custom plugins. It allows you to hook into the CSS generation process, enabling customization and extending functionality. By providing `beforeBuild` and `afterBuild` hooks, you can modify elements before they are compiled into CSS and adjust the compiled CSS afterward. This system is flexible and supports both single and multiple callbacks.
44

5+
::: danger CAUTION
6+
If unnessary, it is not recommended to use this feature. Because it is executed in runtime, which may affect performance.
7+
:::
8+
59
## `register`
610

711
`register` accepts a plugin object with `beforeBuild` and `afterBuild` hooks.
@@ -14,7 +18,7 @@ const plugin = register({
1418
```
1519

1620
::: warning NOTES
17-
The `register` method must be called before `app.mount()`. Otherwise, the plugin will not be registered and the hooks will not be called.
21+
`register` method must be called before `app.mount()`. Otherwise, the plugin will not be registered and the hooks will not be called.
1822
:::
1923

2024
## `beforeBuild` Hook

packages/docs/zh/guide/advances/plugin.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
`vue-styled-components` 支持自定义插件。它允许你在 CSS 生成过程中插入钩子,进行定制和扩展功能。通过提供 `beforeBuild``afterBuild` 钩子,你可以在元素被编译成 CSS 之前进行修改,或者在编译后的 CSS 中进行调整。支持单个或多个回调函数。
44

5+
6+
::: danger CAUTION
7+
如非必要,不建议使用此功能。因为其是在运行时执行的,可能影响性能。
8+
:::
9+
10+
511
## `register`
612

713
`register` 函数接受一个对象,其中包含 `beforeBuild``afterBuild` 钩子。
@@ -14,7 +20,7 @@ const plugin = register({
1420
```
1521

1622
::: warning 注意
17-
The registration function must be called before app.mount(), otherwise, the CSS compilation will occur earlier than the plugin registration, making the plugin ineffective.
23+
注册函数必须在 app.mount() 之前调用, 否则会导致 css 编译比插件注册更早发生, 从而导致插件无效。
1824
:::
1925

2026
## `beforeBuild` 钩子

0 commit comments

Comments
 (0)