A formatter extension for Visual Studio Code that converts plain <svg></svg>
tags in .js
/ .ts
/ .jsx
/ .tsx
files to JSX syntax via SVGR, converting attributes like class
, fill-opacity
and image-rendering
to className
, fillOpacity
and imageRendering
respectively.
git clone https://github.com/darrylyeo/vscode-svg2jsx
npm i
npm run package
npm run install
git clone https://github.com/darrylyeo/vscode-svg2jsx
bun i
bun run package
bun run install
In Visual Studio Code, open the Command Palette with Cmd+Shift+P
, then type and select "Format Document With..."
→ svg2jsx
.
Optionally, in Settings, set Editor: Default Formatter
to svg2jsx
and enable Editor: Format On Save
.