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

nuxt-svg-spritemap

v1.0.3

Published

SVG spritemap builder for Nuxt 3 applications

Downloads

70

Readme

nuxt-svg-spritemap

A library for creating a spritemap for an application on Nuxt 3.

Why?

Using a spritemap is a technique that allows you not to load a bunch of icons as the user opens pages, but to pack all the icons into one file and add it once.

<svg>
  <use xlink:href="#item1"></use>
</svg>

<svg>
  <use xlink:href="#item1"></use>
</svg>

<svg>
  <use xlink:href="#item1"></use>
</svg>

<svg>
  <use xlink:href="#item1"></use>
</svg>

<svg>
  <use xlink:href="#item1"></use>
</svg>

<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
>
  <symbol id="item1">
    <path>...</path>
  </symbol>
</svg>

If you have an application with a bunch of reusable icons, then this option is for you.


Installation

npm i nuxt-svg-spritemap

or

yarn add nuxt-svg-spritemap

Configuration

nuxt.config.js

import nuxtSvgSpritemap from 'nuxt-svg-spritemap/vitePlugin';

const nuxtSvgSpritemapConfig = <Options>;

export default defineNuxtConfig({
  vite: {
    plugins: [nuxtSvgSpritemap(nuxtSvgSpritemapConfig)],
  },
  appConfig: {
    nuxtSvgSpritemapConfig,
  },
});

interface Options

interface Options {
  path2svg: string | string[];
  // path to svg folder.
  // by default: 'assets/svg/'

  logStat: boolean;
  // log build stat after buildings
  // example: Spritemap builded, finded "5" svg files
  // by default: false

  dirSeparator: string;
  // by default: '-'

  transform: function(spritemap:string):string | null;
  // You can transform your svg spritemap before inserting
  // See more in docs/examples/README.md

  outputFilename: string;
  // Filename for spritemap
  // You can use this field for control of output dir.
  // For example: './public/assets/spritemap.svg'
  // by default: './public/spritemap.svg'

  spriteComponentName: string;
  // Sprite vue component name
  // by default: 'SVGSprite'
}

plugins/nuxt-svg-spritemap.js

import nuxtSvgSpritemapPlugin from 'nuxt-svg-spritemap/plugin';

export default defineNuxtPlugin((nuxtApp) =>
  nuxtSvgSpritemapPlugin(nuxtApp, useAppConfig().nuxtSvgSpritemapConfig)
);

After adding the nuxt-svg-spritemap.js file, you don't need to touch it anymore. You must specify and/or change all configuration options in nuxt.config.js. When viewing the examples in the /docs/examples/README.md folder, remember that they are based on the fact that you have already added the plugins/nuxt-svg-spritemap.js file.


NOTE: currently this plugin does not support svg directory tracking. This means that you need to rebuild on changes to the svg directory or files in order to rebuild the spritemap.


Usage

/ <app-root>
├── ...
├── assets
│   └── svg/
│       ├── menu/
│       │   └── unread.svg
│       └── logo.svg
├── pages/
|   └── index.vue
└── ...

/<app-root>/pages/index.vue

<template>
  <SVGSprite name="logo" />
  <SVGSprite name="menu-unread" />
</template>