nuxt-svg-sprite-module

A quick and dirty way to inline svg sprites in your Nuxt app.
3,180 20
Install
npm install nuxt-svg-sprite-module
Latest Version:1.0.7
Vue:2
License:MIT
Last Updated:Dec 8, 2022
Links: GitHub  ·  npm
Maintainer: gavenheim

nuxt-svg-sprite-module

A quick and dirty way to inline svg sprites in your Nuxt app.

Install

$ yarn add nuxt-svg-sprite-module

$ npm install nuxt-svg-sprite-module --save

Configure

In nuxt.config.js

modules: [
  [
    "nuxt-svg-sprite-module",
    {
      directory: "~/assets/icons",
      // Optional template location: defaults to __dirname + /app.html
      templateLocation: "src/app.html",
      options: {
        // Configuration options:
        // https://github.com/jkphl/svg-sprite#configuration-basics
      },
    },
  ],
];

Usage

This module finds svgs in your specified directory and inlines them in Nuxt's app template. You can pass svg-sprite options to be merged with the the default configuration options.

By default, icons are prefixed with the word icon.

<svg>
  <use xlink:href="#icon-foo"></use>
</svg>

In order to tell this module where to inline your sprite you need to include a comment within your app.html file. Idealy this comment would proceed the opening <body> tag. If an app.html file does not exist, one will be generated in its absence.

<!-- svg-sprite -->

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Gaven Heim

Related Packages

vue-svg

Vue directive that will add a svg from an svg sprite sheet to an element.

1,219 4
nuxt-svg-sprite-icon

A powerful SVG sprite module for Nuxt 3 & 4 that automatically generates SVG spr...

36,809 16
@i18n-micro/node

Node.js utilities for loading translations and locale data in Nuxt I18n Micro.

4,423 251
nuxt-svgicon

Nuxt module for vue-svgicon

2,551 6
@eyes22798/svg-icon

a svg icon component use in vue

940 3

Version History

Version Released Vue License
1.0.7 ^2.0 MIT
1.0.6 ^2.0 MIT
1.0.5 ^2.0 MIT
1.0.4 ^2.0 MIT
1.0.3 ^2.0 MIT