0.4.2 • Published 4 years ago
ts-transformer-svg-jsx v0.4.2
ts-transformer-svg-jsx
Transform SVG import into JSX.
Installation
Usage
Use with ttypescript.
{
"compilerOptions": {
"plugins": [{ "transform": "ts-transformer-svg-jsx/transform", "svgo": {} }]
}
}
Use with Babel.
{
"plugins": [["ts-transformer-svg-jsx/babel", { "svgo": {} }]]
}
Example:
import { svgToJsx } from "ts-transformer-svg-jsx";
const CloseIcon = svgToJsx("./close.svg");
function CloseButton() {
return (
<button>
<CloseIcon />
Close
</button>
);
}
License
MIT