{"id":28648894,"url":"https://github.com/endmvp/vite-plugin-svgsg","last_synced_at":"2026-04-18T07:32:48.431Z","repository":{"id":283182698,"uuid":"950968126","full_name":"endmvp/vite-plugin-svgsg","owner":"endmvp","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-02T11:58:35.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T15:54:02.047Z","etag":null,"topics":["icon-sprite-generator","icons","svg","svg-icons","svg-sprite","svg-sprite-loader","svg-sprites","vite","vite-plugin","vite-plugin-svgr","vite-react"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/endmvp.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,"zenodo":null}},"created_at":"2025-03-19T00:50:48.000Z","updated_at":"2025-06-02T11:58:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"b426e014-360c-490b-b554-e490ad07123a","html_url":"https://github.com/endmvp/vite-plugin-svgsg","commit_stats":null,"previous_names":["kristalkill/vite-plugin-svgsg","endmvp/vite-plugin-svgsg"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/endmvp/vite-plugin-svgsg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endmvp%2Fvite-plugin-svgsg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endmvp%2Fvite-plugin-svgsg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endmvp%2Fvite-plugin-svgsg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endmvp%2Fvite-plugin-svgsg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endmvp","download_url":"https://codeload.github.com/endmvp/vite-plugin-svgsg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endmvp%2Fvite-plugin-svgsg/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269688767,"owners_count":24459522,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["icon-sprite-generator","icons","svg","svg-icons","svg-sprite","svg-sprite-loader","svg-sprites","vite","vite-plugin","vite-plugin-svgr","vite-react"],"created_at":"2025-06-13T04:06:08.402Z","updated_at":"2026-04-18T07:32:43.411Z","avatar_url":"https://github.com/endmvp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vite-plugin-svg-sprite\n\nA Vite plugin to generate and manage SVG icon sprites. It scans a directory for SVG files, compiles them into a single sprite, and watches for changes to regenerate the sprite automatically.\n\n## Installation\n\nTo install the plugin, run one of the following command:\n\n```bash\nnpm install vite-plugin-svg-sprite --save-dev\n```\n\n```bash\npnpm add vite-plugin-svg-sprite --save-dev\n```\n\n```bash\nyarn add vite-plugin-svg-sprite --save-dev\n```\n\n## Usage\n\nIn your vite.config.js (or vite.config.ts), add the plugin like this:\n\n```js\nimport { defineConfig } from 'vite';\nimport IconSpritePlugin from 'vite-plugin-svg-sprite';\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [\n    IconSpritePlugin('src/icons', 'dist')  // Specify your icons directory and output directory\n  ]\n});\n```\n1. The plugin watches the specified folder for changes to `.svg` files. It automatically rebuilds the sprite whenever any SVG files in the source directory are modified.\n2. It generates a single SVG sprite file, `icon-sprite.svg`, in the specified output directory. This sprite contains all icons as `\u003csymbol\u003e` elements, with each icon's ID derived from its folder structure and filename (`#subfolder(optional)_filename`).\n3. In components, you can reference icons from the sprite using the `\u003cuse\u003e` tag:\n\n```tsx\nimport Icons from \"./assets/icon-sprite.svg\"\n\n\n\u003csvg width=\"18\" height=\"18\"\u003e\n  \u003cuse href={`${Icons}#footer_phone`}\u003e\u003c/use\u003e\n\u003c/svg\u003e\n```\n\n## Options\n\n- `iconsDir`: The directory containing your SVG icons. (e.g. `'src/icons'`)\n- `outDir`: The output directory where the `icon-sprite.svg` will be generated. (e.g. `'dist'`)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nVasyl Vovk ([GitHub](https://github.com/Kristalkill))\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendmvp%2Fvite-plugin-svgsg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fendmvp%2Fvite-plugin-svgsg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fendmvp%2Fvite-plugin-svgsg/lists"}