JonasKruckenberg / imagetools

Load and transform images using a toolbox :toolbox: of custom import directives!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: SVG support

matthijs166 opened this issue · comments

Hi there,

I'm interested in using the plugin for including SVG images in my Svelte project, but I noticed that the current version does not support SVG. I'm currently using the @poppanator/sveltekit-svg package to handle this, but it would be much more convenient to use a single plugin for all of my media assets.

I suggest adding SVG support to the plugin. One way to optimize the SVGs for loading would be to use the svgo tool, which is available at https://github.com/svg/svgo. This tool can optimize the size of the SVG file, which can help improve the performance of the page by reducing the amount of time it takes to load the resource.

I would really appreciate it if you could consider adding this feature to the plugin. Let me know if you have any questions or if there's anything else I can provide to help with this request.

Do you want to convert SVG to raster images, using this plugin?

No have the image optimized with SVGo for example.
Just like this package for svelte: https://www.npmjs.com/package/@poppanator/sveltekit-svg

I don't think this makes sense given the scope of this plugin. Most directives and options are only applicable to raster images and my original motivation was to improve the DX of optimizing raster images.
While I see the appeal of a one-stop-shop, this plugin is not it.

I would recommend you look at https://github.com/r3dDoX/vite-plugin-svgo for your svg needs

I just came across this one, which looks like it works on both raster images and SVGs: https://github.com/FatehAK/vite-plugin-image-optimizer