Speedy SVGR rewritten in Rust 🦀
⚠️ RVGR RS is in early development and should not be used in production, expect bugs! 🐛
If you are using SVGR RS from Rust, see rustdoc and for most users.
Use SVGR RS in Node.js to complex transformations or tools.
```sh npm install --save-dev @svgr-rs/core
yarn add --dev @svgr-rs/core ```
Import transform
from @svgr-rs/core
to transform a file. It takes three arguments:
source
: the SVG source code to transformoptions
: the options used to transform the SVGstate
: a state linked to the transformation```js import { transform } from '@svgr-rs/core'
const svgCode =
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
</svg>
const jsCode = await transform( svgCode, { icon: true }, { componentName: 'MyComponent' }, ) ```
Transform time without SVGO and Prettier in W3C SVG 1.1 TestSuite: