1
0
Fork 0

chore(markdown): Updated Plugin docs for v3

This commit is contained in:
Joost De Cock 2022-10-02 00:27:09 +02:00
parent 0374b04a59
commit d988f11062
24 changed files with 329 additions and 606 deletions

View file

@ -1,38 +1,30 @@
---
title: "@freesewing/plugin-theme"
title: plugin-theme
---
The **@freesewing-plugin-theme** plugin provides CSS styling for SVG output.
It leverages [the preRender lifecycle hook](/reference/api/hooks/prerender) to
accomplish this.
<Note>
##### Only applies to SVG/PS/PDF output
This plugin will inject CSS in the SVG document when rendering to SVG.
If you use other ways to render your pattern (like our React component)
you will need to apply your own styles.
</Note>
Published as [@freesewing/plugin-theme][1], this plugin provides CSS for
your SVG document when rendering to SVG.
## Installation
```bash
```sh
npm install @freesewing/plugin-theme
```
## Usage
Like all [run-time plugins](/guides/plugins/types-of-plugins#run-time-plugins), you
load them by by passing them to the `use()` method of an instatiated pattern.
Either [add it as a part plugins](/reference/api/part/config/plugins) in your
design, or [add it to a pattern instance with
Pattern.use()](/reference/api/pattern/use).
That method is chainable, so if you have multiple plugins you can just chain them together.
## Notes
```js
import Aaron from "@freesewing/aaron";
import theme from "@freesewing/plugin-theme";
This plugin will inject CSS in the SVG document when rendering to SVG.
If you use other ways to render your pattern (using `Pattern.getRenderProps()`)
you will need to apply your own styles.
The theme plugin is part of our [plugin-bundle](/reference/plugins/bundle)
[1]: https://www.npmjs.com/package/@freesewing/plugin-theme
const pattern = new Aaron().use(theme);
```