Crates.io | rusty-svg |
lib.rs | rusty-svg |
version | 0.1.4 |
created_at | 2025-04-02 01:16:34.90384+00 |
updated_at | 2025-04-23 01:24:40.085014+00 |
description | A CLI to convert SVG files into React components |
homepage | |
repository | https://github.com/cargo-fob/rusty-svg |
max_upload_size | |
id | 1615844 |
size | 2,140,037 |
rusty-svg.config.toml
..svg
files to .tsx
or .jsx
React components<svg {...props}>
IconHome
)rusty-svg.config.toml
)npm i -D rusty-react-svg
rusty-svg --input icons --output components --typescript
rusty-svg
You will be prompted to choose:
If present, rusty-svg will use this file automatically.
input = "icons"
output = "components"
typescript = true
prefix = "Icon"
Config file overrides prompts unless explicitly overridden via CLI flags.
If home.svg exists, the result will be:
import React from 'react';
type Props = React.SVGProps<SVGSVGElement>;
const IconHome = (props: Props) => <svg {...props}>...</svg>;
export default IconHome;
import React from 'react';
const IconHome = (props) => <svg {...props}>...</svg>;
export default IconHome;
Add a script in your package.json:
"scripts": {
"generate:icons": "rusty-svg"
}
Then run:
npm run generate:icons
Ensure ~/.cargo/bin
is in your PATH if you installed rusty-svg with cargo install.