Merge pull request #3222 from BenJamesBen/plugins-doc-updates
fix(docs): Plugins documentation updates
This commit is contained in:
commit
265833d419
26 changed files with 288 additions and 64 deletions
|
@ -17,7 +17,7 @@ const part = {
|
|||
```
|
||||
<Tip>
|
||||
|
||||
You should only list the plugins that required by the part itself,
|
||||
You should only list the plugins that are required by the part itself,
|
||||
not those required by its dependencies
|
||||
|
||||
</Tip>
|
||||
|
@ -44,20 +44,21 @@ const part = {
|
|||
|
||||
## Conditional plugins
|
||||
|
||||
A conditional plugin is loaded conditionally. It should be provided
|
||||
as an object with the following structure:
|
||||
A conditional plugin is loaded only when a condition is met.
|
||||
The plugin and condition should be provided as an `Object`
|
||||
with the following structure:
|
||||
|
||||
```js
|
||||
import myPlugin from './my-plugin.mjs'
|
||||
|
||||
const plugin = {
|
||||
plugin,
|
||||
const myConditionalPlugin = {
|
||||
myPlugin,
|
||||
condition,
|
||||
}
|
||||
```
|
||||
|
||||
Where `plugin` is the plugin itself, and `condition` is the
|
||||
method to determing whether or not to load it.
|
||||
Where `myPlugin` is the plugin itself, and `condition` is a method
|
||||
that returns `true` if the plugin should be loaded.
|
||||
|
||||
<Related>
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ For more details, refer to [the plugin guide](/guides/plugins/).
|
|||
|
||||
```js
|
||||
Pattern pattern.use(object plugin)
|
||||
// or
|
||||
Pattern pattern.use(object plugin, object plugin_data)
|
||||
```
|
||||
|
||||
See [the plugin guide](/guides/plugins/) for details on how to structure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue