jpkleemans / vite-svg-loader

Vite plugin to load SVG files as Vue components
MIT License
585 stars 61 forks source link

Send path to svgo #61

Closed mrleblanc101 closed 2 years ago

mrleblanc101 commented 2 years ago

Fix #60

mrleblanc101 commented 2 years ago

Tested with npm link and work great 👍

jpkleemans commented 2 years ago

Hi Sébastien, thanks for your PR! I'll look into it next week.

mrleblanc101 commented 2 years ago

Thanks

mrleblanc101 commented 2 years ago

Actually I think path should be passed to svgo.optimize({ path: 'path.svg' }) alone and the options should be passed to new svgo(options) but you don't seem to instantiate the plugin like that.

mrleblanc101 commented 2 years ago

Do you want me to make that change too ? See https://github.com/oliverfindl/vue-svg-inline-loader/blob/28051895a5db3c3beba6025963106566d4cee84a/src/index.js#L234

mrleblanc101 commented 2 years ago

Thanks for your work. Could you review my comments? Also, is it possible for you to add a cypress test for this change?

I added one test

jpkleemans commented 2 years ago

Actually I think path should be passed to svgo.optimize({ path: 'path.svg' }) alone and the options should be passed to new svgo(options) but you don't seem to instantiate the plugin like that.

In the svgo readme, it looks like you can add config to optimize just fine: https://github.com/svg/svgo#optimize

jpkleemans commented 2 years ago

Thanks for adding the test! Can you fix the merge conflicts? Then I can merge the PR

mrleblanc101 commented 2 years ago

@jpkleemans I fixed the merge conflicts.

jpkleemans commented 2 years ago

Thank you!