nuxt-modules / svg-sprite

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

Support "custom" `srcDir` #307

Open Siilwyn opened 8 months ago

Siilwyn commented 8 months ago

With a the srcDir set in Nuxt the module won't find the icons and writes output to the default 'root' directory.

So with:

export default defineNuxtConfig({
  srcDir: "src",
  modules: [
    '@nuxtjs/svg-sprite',
  ],
});

Expected would be reading and writing icons from/to: ./src/assets/sprite/ but instead an empty gen is written to ./assets/sprite/.

I've tried some combinations of custom input & output, but couldn't find a working workaround sadly...

Siilwyn commented 5 months ago

Found a workaround just now:

  svgSprite: {
    input: '~/src/assets/sprite/svg',
  }

And then use a symbolic symlink from assets/sprite/gen to src/assets/sprite/gen.