npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svg-sprite-pack

v1.0.2

Published

Pure JavaScript SVG sprite generator

Downloads

9

Readme

svg-sprite-pack

A tool that combines multiple SVG files into a single sprite sheet. It generates SVG sprites with <symbol> elements that can be referenced using <use> tags.

Why use SVG sprites?

SVG sprites with <use> allow CSS styling and adapting icons to light/dark themes. Bundling icons into sprites reduces request overhead even with HTTP/2. Cross-origin <use> references are blocked, so CDN hosting won't work for the sprite file.

Installation

npx svg-sprite-pack <directory>

How it works

The tool looks for directories named sprite in your project and transforms all the SVG files inside into a single optimized sprite sheet. Each icon becomes a <symbol> with an ID based on its filename. Style attributes like fill and stroke are stripped out so you can control everything with CSS. The final sprite is saved next to your component with a -sprite.svg suffix.

Quick start

Create a sprite directory next to your component and drop your SVG icons in there:

src/components/AppSwitch/
├── sprite/
│   ├── play.svg
│   └── pause.svg
├── AppSwitch.tsx
└── AppSwitch.module.css

Run the tool:

npx svg-sprite-pack src/components

You'll get AppSwitch-sprite.svg next to your component. Use it in your code:

import sprite from './AppSwitch-sprite.svg?url';

<svg width={24} height={24}>
  <use xlinkHref={`${sprite}#play`} />
</svg>

The ?url import syntax depends on your bundler — adjust as needed. The important part is getting a URL to your sprite file.

Features

The tool recursively searches for directories named sprite and generates optimized sprite files. It automatically converts filenames into slugified IDs (my-icon.svg becomes #my-icon) and applies SVGO optimization to minimize file size. No build configuration or native dependencies required — just Node.js 18 or later.