Developmint/nuxt-svg-loader

Please, add some more usage info to the project description

AndrewBogdanovTSS opened this issue Β· 5 comments

I understand that it's a wrapper around vue-svg-loader but still it would be nice to have some usage info specific to nuxt 2 here, such as this part:
https://github.com/visualfanatic/vue-svg-loader#nuxtjs-1x--2x

Hey @AndrewBogdanovTSS.

What exactly comes to your mind there? How to import SVGs then? (As additional configurations are not necessary)

Hey @manniL πŸ˜ƒ
For example how can it be configured with custom settings. e.g. my svg is located in ./assets/svg/general/camera.svg and when I try to use them inside my components I'm getting

[Vue warn]: Unknown custom element: <camera> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

so I suppose default config is looking for svg's in another place

or another question - is there a way to register all svg's globally in a plugin

You could import that SVG as component with import Camera from '~/assets/svg/general/camera.svg' then and use it like a component ☺️ (example is in the live-demo under test/fixtures/pages/ πŸ‘)

Globally registering all SVGs is likely possible with a plugin similar to how you'd globally register Vue components πŸ‘Œ

Yeah, so there you have it πŸ˜ƒ
Those two things at least could make usage a bit more straight forward.

Agreed! I'd accept a PR for that as well πŸ™Š