Skip to content
PluginStats

vite-plugin-svg-spritemap weekly downloads statistics

By g-makarov · npm · Vite plugins

Generates a SVG spritemap from multiple .svg files

View on npm Fresh · Oct 17, 2026

vite-plugin-svg-spritemap has 9,393 recorded weekly downloads on npm, an increase of 1.9% over the past 30 days.

It ranks #925 of 2,251 tracked npm listings by weekly downloads.

Over 90 days, weekly downloads changed by +403%.

PluginStats has 542 daily observations since Apr 24, 2025; the latest is from Oct 17, 2026.

Weekly downloads
9,393
Official API · Oct 17, 2026
7-day growth
-54.1%
-11.1K weekly downloads
30-day growth
+1.9%
+175 weekly downloads
90-day growth
+403%
+7.5K weekly downloads
Rank
#925
Among tracked npm listings

About vite-plugin-svg-spritemap

vite-plugin-svg-spritemap

A Vite plugin that bundles a directory of .svg files into a single spritemap of elements.

• Optionally generates a TypeScript union of the icon names, so a typo is a build error • Optimizes icons with SVGO • Hoists to the top level and namespaces their ids, so gradients, patterns and masks keep working and never collide • Optional output for and CSS background-image • Content hashing for long-term caching • HMR: editing an icon swaps it in place, without reloading the page

Requirements

Vite 5–8, Node 20.19+. ESM only.

Installation

Usage

Each file becomes a whose id is the filename without extension — src/icons/arrow.svg → #arrow.

The sprite is written to the build output directory and served at the same path in dev. Use the deprecated xlink:href instead of href if you need to support legacy browsers.

React

Turn on types to make name a union of the actual icon names instead of string.

Options

| Option | Type | Default | Description |

| pattern | string | — | Glob of the SVG files to include. Required. | | filename | string | spritemap.svg | Output filename. Supports [hash]. | | symbolId | string \| (file, name) => string | [name] | Template for the symbol ids. Tokens: [name], [dir]. A function gets the file path and the base name. | | svgo | SVGOConfig \| boolean | true | SVGO optimization. Pass a config object to customize it. | | currentColor | boolean | false | Replace colors with currentColor so icons inherit CSS color. | | view | boolean | false | Also emit elements, so icons work in and CSS background-image. | | hmr | boolean | true | Update icons in place in dev. Set to false to reload the whole page instead. | | types | boolean \| string | false | Generate a module with the icon names. true writes src/spritemap-icons.ts; pass a path to change it. |

The sprite is emitted as a Rollup asset, so other plugins — compression, for instance — see it like any other build output.

Duplicate names

Ids have to be unique within the sprite. With a recursive glob, icons/ui/close.svg and icons/nav/close.svg both want #close; the plugin keeps the first and warns about the second. Set symbolId to tell them apart:

A literal prefix is just part of the template — symbolId: 'icon-[name]' gives #icon-arrow.

Ids declared inside an icon (gradients, masks, clip paths) are namespaced automatically, so two icons that both define id="a" no longer overwrite each other.

Long-term caching

Put [hash] in filename and the name changes only when the icons do:

The generated module exports the resolved URL, so nothing has to be hardcoded:

The dev server keeps a stable [hash] of dev, so references do not go stale on edit.

Icons in and CSS

A is never rendered, which is why an pointing at one comes out blank. Turn view on and each icon also gets a framing it, addressable with a -view suffix:

Icons used this way cannot inherit currentColor — the browser renders them as an independent document.

Typed icon names

Turn types on and the plugin writes a module listing every symbol in the sprite:

Use the type wherever an icon name is accepted, and a typo stops being a silently blank icon:

The iconNames array is a real runtime value, which is handy for rendering every icon at once in a gallery or a Storybook story.

The file is rewritten whenever an icon is added or removed, in dev and on build. It is generated output — add it to .gitignore if you would rather not commit it.

HMR

In dev the plugin injects a small client script that listens for sprite changes and repoints every at the rebuilt sprite. Editing, adding or removing an icon updates the page without a reload, so application state survives.

The references are rewritten to /spritemap.svg?t=#icon — the query is what forces the browser to re-resolve an external SVG document. Nothing is injected in production builds.

references are updated the same way. CSS background-image is not — set hmr: false if your icons live in stylesheets and you want a reload instead.

If your app renders elements into a shadow root, they are out of reach of the client script; hmr: false covers that too.

Upgrading from 1.x

See the changelog. The short version: the package is ESM only, needs Vite 5+, emit is gone (the sprite is always a Rollup asset), and prefix is replaced by symbolId: 'prefix-[name]'.

License

MIT

If this plugin is useful to you, you can buy me a coffee.

Description from the npm listing.

  • vite-plugin
  • vite
  • plugin
  • svg
  • spritemap
  • svg-spritemap
  • symbol
  • symbols
  • svg-symbol
  • svg-sprite
  • sprite
  • sprites
  • icon
  • icons
  • typescript

Where vite-plugin-svg-spritemap sits in the listing

Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

All npm2,248 listings · 113 pages · page 47, #5 (overall #925)
All npm: every listing in weekly downloads order
PNG SVG
Vite plugins250 listings · 13 pages · page 8, #18 (overall #158)
Vite plugins: every listing in weekly downloads order
PNG SVG

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vite-plugin-svg-spritemap weekly downloads on npm, last 90 days: 9,393 weekly downloads as of Oct 17, 2026, +403% over 90 days.vite-plugin-svg-spritemapWeekly downloads on npm · Last 90 days9,393downloads / week+403% over 90 days05K10K15K20K25KJul 19Aug 3Aug 18Sep 2Sep 17Oct 2Oct 17downloads / weekobservedarchived (Internet Archive)no observationsJul 20, 2026 – Oct 17, 2026 · 90 observations · Updated Oc…pluginstats.com
vite-plugin-svg-spritemap weekly downloads on npm, last 90 days: 9,393 weekly downloads as of Oct 17, 2026, +403% over 90 days.
PNG SVG

7/30/90-day growth

vite-plugin-svg-spritemap weekly downloads growth on npm: -54.1% over 7 days, +1.9% over 30 days, +403% over 90 days.vite-plugin-svg-spritemapWeekly downloads growth on npm9,393downloads / week now7-day growth-11,060 weekly downloads-54.1%30-day growth+175 weekly downloads+1.9%90-day growth+7,526 weekly downloads+403%Growth vs. nearest observation to each baseline date · Updated Oct 17, 2026pluginstats.com
vite-plugin-svg-spritemap weekly downloads growth on npm: -54.1% over 7 days, +1.9% over 30 days, +403% over 90 days.
PNG SVG

Ranking history

vite-plugin-svg-spritemap npm ranking history: currently #925 (by weekly downloads).vite-plugin-svg-spritemapnpm ranking · by weekly downloads · Last 90 days#925current rank#300#400#500#600#700#800#900#1000Jul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18rankOct 17, 2026 – Oct 18, 2026 · 2 observations · Updated Oct 17, 2026pluginstats.com
vite-plugin-svg-spritemap npm ranking history: currently #925 (by weekly downloads).
PNG SVG

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Recent observations

Full history (542)
Recent weekly downloads observations for vite-plugin-svg-spritemap
Date (UTC)Weekly downloadsChange vs. previous
9,393-1.3K
10,693-2.2K
12,924-4.7K
17,637-4.2K
21,8740
21,874+1.6K
20,274-179
20,453+479
19,974+1.8K
18,196+795
17,401+2K
15,367-2.1K
17,507+2.8K
14,724—

Similar npm Vite plugins plugins

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vite-plugin-svg-spritemap. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.