vite-plugin-magical-svg
Version:
An all-in-one Vite plugin that magically makes working with SVGs and bundling them a breeze
23 lines (19 loc) • 585 B
JavaScript
import { createElement, forwardRef } from "react";
export var createSvg = /*#__NO_SIDE_EFFECTS__*/ (viewBox, width, height, symbol) => {
let node = createElement("use", { href: symbol });
return forwardRef((props, ref) => {
return createElement("svg", { ref, viewBox, width, height, ...props }, node);
});
};
export var createSvgDEV = /*#__NO_SIDE_EFFECTS__*/ (viewBox, width, height, xml) => {
return forwardRef((props, ref) => {
return createElement("svg", {
ref,
viewBox,
width,
height,
...props,
dangerouslySetInnerHTML: { __html: xml },
});
});
};