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 🙏

© 2025 – Pkg Stats / Ryan Hefner

svgc

v1.0.0

Published

Convert SVG spritemaps into CSS stylesheets

Readme

svgc

NPM Version

svgc is a command line tool that converts SVG spritemaps into CSS stylesheets.

npm install -g svgc

Usage

Pass your SVG spritemap into svgc.

svgc assets/svg/symbol-defs.svg

svgc will read the contents of the SVG and find any symbols with ids.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
	<symbol id="camera" viewBox="0 0 512 512">
		<path d="M152 304c0 57.438 46.562 104 104 104s104-46.562 104-104-46.562-104-104-104-104 46.562-104 104zm328-176h-112c-8-32-16-64-48-64h-128c-32 0-40 32-48 64h-112c-17.6 0-32 14.4-32 32v288c0 17.6 14.4 32 32 32h448c17.6 0 32-14.4 32-32v-288c0-17.6-14.4-32-32-32zm-224 318c-78.425 0-142-63.574-142-142 0-78.425 63.575-142 142-142 78.426 0 142 63.575 142 142 0 78.426-63.573 142-142 142zm224-222h-64v-32h64v32z"/>
	</symbol>
	<symbol id="pencil">
		<path d="M432 0c44.182 0 80 35.817 80 80 0 18.01-5.955 34.629-16 48l-32 32-112-112 32-32c13.371-10.045 29.989-16 48-16zm-400 368l-32 144 144-32 296-296-112-112-296 296zm325.789-186.211l-224 224-27.578-27.578 224-224 27.578 27.578z"/>
	</symbol>
</svg>

svgc will produce a CSS stylesheet with those symbols inlined as data URIs.

.camera {
	background-image: url(data:image/svg+xml;charset=utf-8,%3Csvg viewBox=%220 0 512 512%22 xmlns=%22http://www.w3.org/2000/svg%22%3E %3Cpath d=%22M152 304c0 57.438 46.562 104 104 104s104-46.562 104-104-46.562-104-104-104-104 46.562-104 104zm328-176h-112c-8-32-16-64-48-64h-128c-32 0-40 32-48 64h-112c-17.6 0-32 14.4-32 32v288c0 17.6 14.4 32 32 32h448c17.6 0 32-14.4 32-32v-288c0-17.6-14.4-32-32-32zm-224 318c-78.425 0-142-63.574-142-142 0-78.425 63.575-142 142-142 78.426 0 142 63.575 142 142 0 78.426-63.573 142-142 142zm224-222h-64v-32h64v32z%22/%3E %3C/svg%3E);
}

.pencil {
	background-image: url(data:image/svg+xml;charset=utf-8,%3Csvg viewBox=%220 0 512 512%22 xmlns=%22http://www.w3.org/2000/svg%22%3E %3Cpath d=%22M432 0c44.182 0 80 35.817 80 80 0 18.01-5.955 34.629-16 48l-32 32-112-112 32-32c13.371-10.045 29.989-16 48-16zm-400 368l-32 144 144-32 296-296-112-112-296 296zm325.789-186.211l-224 224-27.578-27.578 224-224 27.578 27.578z%22/%3E %3C/svg%3E);
}

Options

--prefix <prefix>

Prepends this prefix and a dash to each CSS selector.

svg/symbol-defs.svg --prefix icon
.icon-camera { ... }

.icon-pencil { ... }

--suffix <suffix>

Appends this suffix to each CSS selector.

svg/symbol-defs.svg --suffix ::after
.camera::after { ... }

.pencil::after { ... }

--url <file>

Use an external url and reference fragments rather than inlining the contents of the SVG.

svg/symbol-defs.svg --url ../svg/symbol-defs.svg
.camera {
	background-image: url(../svg/symbol-defs.svg#camera);
}

.pencil {
	background-image: url(../svg/symbol-defs.svg#pencil);
}

--base64

Use base64-encoded data URIs when generating the stylesheet.

svg/symbol-defs.svg --base64
.camera {
	background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMTUyIDMwNGMwIDU3LjQzOCA0Ni41NjIgMTA0IDEwNCAxMDRzMTA0LTQ2LjU2MiAxMDQtMTA0LTQ2LjU2Mi0xMDQtMTA0LTEwNC0xMDQgNDYuNTYyLTEwNCAxMDR6bTMyOC0xNzZoLTExMmMtOC0zMi0xNi02NC00OC02NGgtMTI4Yy0zMiAwLTQwIDMyLTQ4IDY0aC0xMTJjLTE3LjYgMC0zMiAxNC40LTMyIDMydjI4OGMwIDE3LjYgMTQuNCAzMiAzMiAzMmg0NDhjMTcuNiAwIDMyLTE0LjQgMzItMzJ2LTI4OGMwLTE3LjYtMTQuNC0zMi0zMi0zMnptLTIyNCAzMThjLTc4LjQyNSAwLTE0Mi02My41NzQtMTQyLTE0MiAwLTc4LjQyNSA2My41NzUtMTQyIDE0Mi0xNDIgNzguNDI2IDAgMTQyIDYzLjU3NSAxNDIgMTQyIDAgNzguNDI2LTYzLjU3MyAxNDItMTQyIDE0MnptMjI0LTIyMmgtNjR2LTMyaDY0djMyeiIvPgo8L3N2Zz4=);
}

.pencil {
	background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNNDMyIDBjNDQuMTgyIDAgODAgMzUuODE3IDgwIDgwIDAgMTguMDEtNS45NTUgMzQuNjI5LTE2IDQ4bC0zMiAzMi0xMTItMTEyIDMyLTMyYzEzLjM3MS0xMC4wNDUgMjkuOTg5LTE2IDQ4LTE2em0tNDAwIDM2OGwtMzIgMTQ0IDE0NC0zMiAyOTYtMjk2LTExMi0xMTItMjk2IDI5NnptMzI1Ljc4OS0xODYuMjExbC0yMjQgMjI0LTI3LjU3OC0yNy41NzggMjI0LTIyNCAyNy41NzggMjcuNTc4eiIvPgo8L3N2Zz4=);
}