nuxt-modules / svg-sprite

Optimize SVG files and combine them into sprite
https://codesandbox.io/s/github/nuxt-community/svg-sprite-module/
MIT License
302 stars 42 forks source link

Empty sprite after build #158

Closed Whiled0S closed 4 years ago

Whiled0S commented 4 years ago

Hello, thanks for this nice tool, but it works for me only in dev mode. When I build my project then sprite generates without any icons (in development everything is OK, sprite generates perfectly). I just follow the main guide and I don't know why it happens, I hope anyone can help me.

Below I provide screenshots which may be helpful:

My modules in nuxt.config.js:

image

File structure:

image

icons.svg file:

image

build:

image

image

image

Whiled0S commented 4 years ago

I solved this issue by setting svgo option to null in imagemin config, because by default it optimizes all images in assets folder and, apparently, svg sprite too. Now my imagemin config looks like:

    ['nuxt-imagemin', {
      svgo: null,
      plugins: [
        imageminMozjpeg({
          quality: 100,
          progressive: true
        })
      ]
    }]