1
0
Fork 0

Merge pull request #3222 from BenJamesBen/plugins-doc-updates

fix(docs): Plugins documentation updates
This commit is contained in:
Joost De Cock 2022-12-14 10:11:01 +01:00 committed by GitHub
commit 265833d419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 288 additions and 64 deletions

View file

@ -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>

View file

@ -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