Developmint / nuxt-svg-loader

SVGs as components, also on the server side!
MIT License
144 stars 14 forks source link

Please, add some more usage info to the project description #7

Closed AndrewBogdanovTSS closed 5 years ago

AndrewBogdanovTSS commented 5 years ago

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

manniL commented 5 years ago

Hey @AndrewBogdanovTSS.

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

AndrewBogdanovTSS commented 5 years ago

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

manniL commented 5 years ago

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 πŸ‘Œ

AndrewBogdanovTSS commented 5 years ago

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

manniL commented 5 years ago

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