{"id":15566937,"url":"https://github.com/svg-rust/svgr-rs","last_synced_at":"2025-04-05T07:08:03.754Z","repository":{"id":153215212,"uuid":"618237420","full_name":"svg-rust/svgr-rs","owner":"svg-rust","description":"Speedy SVGR rewritten in Rust 🦀. Transforms SVG into React Components.","archived":false,"fork":false,"pushed_at":"2024-10-08T04:37:19.000Z","size":1207,"stargazers_count":57,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T06:04:08.676Z","etag":null,"topics":["rust","svg","svgr","swc"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/svg-rust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-24T03:07:46.000Z","updated_at":"2025-02-25T15:56:52.000Z","dependencies_parsed_at":"2024-01-15T00:28:18.175Z","dependency_job_id":"22f231e9-f4a6-4556-825d-0d2285175bcf","html_url":"https://github.com/svg-rust/svgr-rs","commit_stats":{"total_commits":154,"total_committers":3,"mean_commits":"51.333333333333336","dds":0.01948051948051943,"last_synced_commit":"b3c12f59e0e80b5f91e952437148653446eaeaf2"},"previous_names":["symind/svgr-rs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg-rust%2Fsvgr-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg-rust%2Fsvgr-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg-rust%2Fsvgr-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svg-rust%2Fsvgr-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svg-rust","download_url":"https://codeload.github.com/svg-rust/svgr-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299833,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","svg","svgr","swc"],"created_at":"2024-10-02T17:08:56.255Z","updated_at":"2025-04-05T07:08:03.713Z","avatar_url":"https://github.com/svg-rust.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eSVGR RS\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eSpeedy SVGR rewritten in Rust 🦀\u003c/p\u003e\n\nIf you are using SVGR RS from Rust, see [rustdoc](https://docs.rs/svgr-rs/0.1.2/svgr_rs/) and for most uses.\n\n# Webpack\n\nSVGR RS provides an [webpack](https://webpack.js.org/) loader to import SVG as React components.\n\n## Install\n\n```sh\nnpm install --save-dev @svgr-rs/svgrs-plugin\n# or use yarn\nyarn add --dev @svgr-rs/core\n```\n\n## Usage\n\nwebpack.config.js\n\n```js\n{\n  test: /\\.svg$/i,\n  issuer: /\\.[jt]sx?$/,\n  resourceQuery: /react/,\n  use: [\n    {\n      loader: '@svgr-rs/svgrs-plugin/webpack',\n      options: {\n        exportType: 'named',\n        namedExport: 'ReactComponent',\n      },\n    },\n  ],\n}\n```\n\n# Vite\n\nSVGR RS provides an [vite](https://vitejs.dev/) plugin to import SVG as React components.\n\n## Install\n\n```sh\nnpm install --save-dev @svgr-rs/svgrs-plugin\n# or use yarn\nyarn add --dev @svgr-rs/core\n```\n\n## Usage\n\nvite.config.js\n\n```js\nimport react from '@vitejs/plugin-react'\nimport { svgrs } from '@svgr-rs/svgrs-plugin/vite'\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    svgrs({\n      exportType: 'named',\n      namedExport: 'ReactComponent',\n    })\n  ],\n})\n```\n\n# Node.js\n\nUse SVGR RS in Node.js to complex transformations or tools.\n\n## Install\n\n```sh\nnpm install --save-dev @svgr-rs/core\n# or use yarn\nyarn add --dev @svgr-rs/core\n```\n\n## Usage\n\nImport `transform` from `@svgr-rs/core` to transform a file. It takes three arguments:\n\n* `source`: the SVG source code to transform\n* `options`: the options used to transform the SVG\n* `state`: a state linked to the transformation\n\n```js\nimport { transform } from '@svgr-rs/core'\n\nconst svgCode = `\n\u003csvg xmlns=\"http://www.w3.org/2000/svg\"\n  xmlns:xlink=\"http://www.w3.org/1999/xlink\"\u003e\n  \u003crect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n    style=\"stroke:#ff0000; fill: #0000ff\"/\u003e\n\u003c/svg\u003e\n`\n\nconst jsCode = await transform(\n  svgCode,\n  { icon: true },\n  { componentName: 'MyComponent' },\n)\n```\n\n# Benchmarks\n\nTransform time without SVGO and Prettier in W3C SVG 1.1 TestSuite:\n\n![Transform time](./snapshots/transform-time.png)\n\n# Roadmap\n\n- [x] jsxRuntime\n- [x] jsxRuntimeImport\n- [x] icon\n- [x] native\n- [x] typescript\n- [x] dimensions\n- [x] expandProps\n- [ ] prettier\n- [ ] prettierConfig\n- [ ] svgo ([Speedy SVGO rewritten in Rust](https://github.com/svg-rust/svgo-rs) is working in progress)\n- [ ] svgoConfig\n- [x] ref\n- [x] memo\n- [x] replaceAttrValues\n- [x] svgProps\n- [x] titleProp\n- [x] descProp\n\n# License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvg-rust%2Fsvgr-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvg-rust%2Fsvgr-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvg-rust%2Fsvgr-rs/lists"}