oliverfindl / vue-svg-inline-plugin

Vue plugin for inline replacement of SVG images with actual content of SVG files.
MIT License
33 stars 3 forks source link

Custom directive not working #12

Closed mattzahel closed 2 years ago

mattzahel commented 2 years ago

During the migration of my Vue 3 app from Webpack to Vite, I decided to switch from https://github.com/oliverfindl/vue-svg-inline-loader to this plugin, as it was recommended in README. Unfortunately, I had to rename all directive usages from svg-inline to v-svg-inline, because the custom directive simply doesn't work.

Reproduction link: https://codesandbox.io/s/relaxed-mendel-98zk3y

Am I missing something or this is a bug?

oliverfindl commented 2 years ago

Hello,

this plugin uses by default v-svg-inline directive name. You could change it according to plugin options, but Vue will automatically register it with v- prefix anyway. Because of this convention (Vue directives always starting with v- prefix), this plugin is not drop-in replacement for vue-svg-inline-loader. In this case, It was my fault when I initially created vue-svg-inline-loader without v- prefix for directive name, because it was iteration of another (not-Vue related) project.

If you have more questions, feel free to ask here.

Thanks.

mattzahel commented 2 years ago

That makes sense, thanks a lot for your explanation @oliverfindl!