{"_id":"@crabvk/vite-plugin-svg-sprite","_rev":"2-1ee41dc8dddd31a6c273f3170e5cc650","name":"@crabvk/vite-plugin-svg-sprite","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@crabvk/vite-plugin-svg-sprite","version":"0.1.0","keywords":["vite plugin","svg","svg sprite"],"author":{"name":"Vyacheslav Konovalov","email":"crabvk@protonmail.com"},"license":"MIT","_id":"@crabvk/vite-plugin-svg-sprite@0.1.0","maintainers":[{"name":"crabvk","email":"crabvk@protonmail.com"}],"homepage":"https://github.com/crabvk/vite-plugin-svg-sprite","bugs":{"url":"https://github.com/crabvk/vite-plugin-svg-sprite/issues"},"dist":{"shasum":"8d6340d4a8a80e8688e29cf511a3aa8243ec4e18","tarball":"https://registry.npmjs.org/@crabvk/vite-plugin-svg-sprite/-/vite-plugin-svg-sprite-0.1.0.tgz","fileCount":6,"integrity":"sha512-qgJHi6qnfw0gn+cqRurYrZtiNZNEjhl14fBLAA5y/xeELbothaOJEvasJsMao2ERIlTuInUz/U3NaSFDHhx6SQ==","signatures":[{"sig":"MEUCIQDP09IqswezIoNSL2uIuUDJzZRK6VvZg7IkLDtSgKCWngIgPf469bo7fUnWfVIvr6Yu9Wj1PsAplDiIVasx8LJSYvI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19113},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","exports":{".":{"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./client":{"default":{"types":"./src/client.d.ts"}}},"gitHead":"1ac9bc280461f95458c4536fef7d8a977376e729","_npmUser":{"name":"crabvk","email":"crabvk@protonmail.com"},"repository":{"url":"git+https://github.com/crabvk/vite-plugin-svg-sprite.git","type":"git"},"_npmVersion":"11.5.2","description":"A lightweight Vite plugin that generates SVG sprite from SVG files for efficient use in your application.","directories":{},"_nodeVersion":"24.5.0","dependencies":{"svgo":"^4.0.0","jsdom":"^26.1.0","chokidar":"^4.0.3","typescript":"^5.9.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^24.2.0","@types/jsdom":"^21.1.7","@biomejs/biome":"2.0.6"},"peerDependencies":{"vite":"^6 || ^7"},"_npmOperationalInternal":{"tmp":"tmp/vite-plugin-svg-sprite_0.1.0_1754382787426_0.4658562686829266","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@crabvk/vite-plugin-svg-sprite","version":"0.1.1","description":"A lightweight Vite plugin that generates SVG sprite from SVG files for efficient use in your application.","license":"MIT","type":"module","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","keywords":["vite plugin","svg","svg sprite"],"author":{"name":"Vyacheslav Konovalov","email":"crabvk@protonmail.com"},"homepage":"https://github.com/crabvk/vite-plugin-svg-sprite","repository":{"type":"git","url":"git+https://github.com/crabvk/vite-plugin-svg-sprite.git"},"peerDependencies":{"vite":"^8"},"dependencies":{"chokidar":"^5.0.0","jsdom":"^29.0.1","svgo":"^4.0.1","typescript":"^6.0.2"},"devDependencies":{"@biomejs/biome":"2.4.10","@types/jsdom":"^28.0.1","@types/node":"^25.5.0"},"exports":{".":{"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./client":{"default":{"types":"./src/client.d.ts"}}},"_id":"@crabvk/vite-plugin-svg-sprite@0.1.1","bugs":{"url":"https://github.com/crabvk/vite-plugin-svg-sprite/issues"},"_integrity":"sha512-vVnJACx4t3+AgY9vuUvZiScNSDQg5s23i48KuMD/wSGlq/jYEiTU7b0cT456DL/9ua8IAwrsi/+t9UmQtdr0ig==","_resolved":"/tmp/2091cd14c84a6a7d71fdfff3ba366971/crabvk-vite-plugin-svg-sprite-0.1.1.tgz","_from":"file:crabvk-vite-plugin-svg-sprite-0.1.1.tgz","_nodeVersion":"25.8.2","_npmVersion":"11.12.1","dist":{"integrity":"sha512-vVnJACx4t3+AgY9vuUvZiScNSDQg5s23i48KuMD/wSGlq/jYEiTU7b0cT456DL/9ua8IAwrsi/+t9UmQtdr0ig==","shasum":"e983b8f9e5eca0b2e248bfb0ea86fa72189bd81a","tarball":"https://registry.npmjs.org/@crabvk/vite-plugin-svg-sprite/-/vite-plugin-svg-sprite-0.1.1.tgz","fileCount":6,"unpackedSize":19107,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEId9pJi1Tx6SAKXR6vJ6P5QqgkJbjvvaWcqHod3y51fAiAuDeomXPTtNrkz32m5TOTtZpPTz4kZxg8+h8DjUlHhUw=="}]},"_npmUser":{"name":"crabvk","email":"crabvk@protonmail.com"},"directories":{},"maintainers":[{"name":"crabvk","email":"crabvk@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-plugin-svg-sprite_0.1.1_1775042013838_0.07328833931468393"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-05T08:33:07.341Z","modified":"2026-04-01T11:13:34.107Z","0.1.0":"2025-08-05T08:33:08.087Z","0.1.1":"2026-04-01T11:13:33.987Z"},"bugs":{"url":"https://github.com/crabvk/vite-plugin-svg-sprite/issues"},"author":{"name":"Vyacheslav Konovalov","email":"crabvk@protonmail.com"},"license":"MIT","homepage":"https://github.com/crabvk/vite-plugin-svg-sprite","keywords":["vite plugin","svg","svg sprite"],"repository":{"type":"git","url":"git+https://github.com/crabvk/vite-plugin-svg-sprite.git"},"description":"A lightweight Vite plugin that generates SVG sprite from SVG files for efficient use in your application.","maintainers":[{"name":"crabvk","email":"crabvk@protonmail.com"}],"readme":"# SVG sprite plugin for Vite.\n\nVite plugin for generating SVG sprite from SVG files.\n\nBased on [@pivanov/vite-plugin-svg-sprite](https://github.com/pivanov/vite-plugin-svg-sprite).\n\n## Improvements\n\n* Use [jsdom](https://github.com/jsdom/jsdom) instead of [cheerio](https://github.com/cheeriojs/cheerio) for SVG parsing.\n* Add SVG sprite contents hash to output file name.\n* Serve SVG sprite file in development.\n* Allows for any SVG tag attributes via the `attributes` plugin option.\n* Output dynamic type for better DX.\n\n## Install\n\n```shell\nnpm i -D @crabvk/vite-plugin-svg-sprite\n```\n\n## Usage\n\nAdd plugin to your *vite.config.ts*:\n\n```typescript\nimport svgSprite from '@crabvk/vite-plugin-svg-sprite'\n\nexport default {\n  plugins: [\n    svgSprite({\n      // Can be a string or an object (required).\n      include: {\n        regular: 'src/icons/fontawesome/regular',\n        solid: 'src/icons/fontawesome/solid',\n      },\n      // Add resulting SVG sprite to the index.html (optional).\n      inject: 'body-last',\n      // Override default SVGO config. See src/index.ts for the default (optional).\n      svgoConfig: {},\n      // Output SVG sprite into dist/assets directory (optional).\n      fileName: 'sprite-[hash].svg',\n      // Attributes added to the resulting SVG sprite (optional).\n      attributes: {\n        id: 'svg-sprite',\n        style: 'position:absolute;width:0;height:0;'\n      },\n      // Directory relative to your project root\n      // where to output dynamic type file (see React example below) (optional).\n      typesDir: 'types',\n    }),\n  ],\n}\n```\n\nTo use 'virtual:svg-sprite' module add to your *src/vite-env.d.ts*:\n\n```typescript\n/// <reference types=\"@crabvk/vite-plugin-svg-sprite/client\" />\n```\n\nTo use dynamic type add to your *tsconfig.json* `\"include\"` option:\n\n```json\n{\n  \"include\": [\"src\", \"types/vite-plugin-svg-sprite.d.ts\"]\n}\n```\n\nUse in your React project:\n\n```tsx\n// Virtual Vite module exporting `sprite` and `url` variables.\nimport { url } from 'virtual:svg-sprite'\n// Dynamic type defining scopes and symbol names for each scope.\nimport type { SymbolId } from '@crabvk/vite-plugin-svg-sprite/types'\n\ninterface IconProps<T extends keyof SymbolId> {\n  variant: T\n  name: SymbolId[T]\n}\n\nexport default function Icon<T extends keyof SymbolId>({ variant, name }: IconProps<T>) {\n  return (\n    <svg>\n      <use href={`${url}#${variant}-${name}`} />\n    </svg>\n  )\n}\n```\n","readmeFilename":"README.md"}