Skip to content

Commit

Permalink
docs: no need to register manually nitro plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Oct 18, 2022
1 parent 005fdfd commit b6bbb42
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions docs/content/4.api/4.advanced.md
Expand Up @@ -12,24 +12,14 @@ The module adds some hooks you can use:

`content:file:*` hooks are available in nitro runtime, in order to use them you need to create a custom [nitro plugin](https://nitro.unjs.io/guide/plugins.html).

- Create a plugin in the `server/plugins/` directory
Create a plugin in the `server/plugins/` directory

```ts [server/plugins/content.ts]
export default defineNitroPlugin((nitroApp) => {
// ...
})
```

- Register the plugin in `nuxt.config.ts`
```ts [server/plugins/content.ts]
export default defineNitroPlugin((nitroApp) => {
// ...
})
```

```ts [nuxt.config.ts]
export default defineNuxtConfig({
// ...
nitro: {
plugins: ['~/server/plugins/content.ts']
}
})
```

### `content:file:beforeParse`

Expand All @@ -44,8 +34,7 @@ Arguments:

### Example

Changing all occurrences of react to vue in all Markdown files:

Changing all occurrences of React to Vue in all Markdown files:

```ts [server/plugins/content.ts]
export default defineNitroPlugin((nitroApp) => {
Expand Down

0 comments on commit b6bbb42

Please sign in to comment.