1
0
Fork 0
freesewing/markdown/dev/reference/plugins/svgattr/en.md
2022-02-19 08:04:25 +01:00

869 B

title
@freesewing/plugin-svgattr

The @freesewing/plugin-svgattr plugin takes an object of key-value pairs and adds them ass attributes to your SVG document on render. It leverages the preRender lifecycle hook to do so.

Installation

npm install @freesewing/plugin-svgattr

Usage

Like all build-time plugins, you load them by passing them to the freesewing.Design super-constructor:

import Aaron from "@freesewing/aaron";
import svgAttr from "@freesewing/plugin-svgattr";
import translations from "@freesewing/i18n";

const myAaron = new Aaron()
  .use(svgAttr, { class: "freesewing pattern" });

You should pass a second argument which holds key-value pairs of the attributes you want to add to the SVG tag.