qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[✨] Compress SVG nodes with svgo

Open DustinJSilk opened this issue 2 years ago • 2 comments

Is your feature request related to a problem?

SVG can be compressed and optimised a lot. By using a tool like (svgo)[https://github.com/svg/svgo], developers won't need to manually copy/paste their SVG files into (OMGSVG)[https://jakearchibald.github.io/svgomg/] or similar to improves the size and performance.

Describe the solution you'd like

  • Automatically detect SVG nodes in a component and run it against svgos optimiser at build time.
  • Allow using a svgo.config.js file to fine tune the optimisations and results

Describe alternatives you've considered

I've looked at the current svg output by qwik which looks minified, not optimised. But i could be wrong. I also didnt see svgo in the qwik repo

Additional context

No response

DustinJSilk avatar Jan 16 '23 07:01 DustinJSilk

To me, this seems like something that should be done in a plugin. Not everyone would want this and not everyone would want it with the same settings...

Here's one https://www.npmjs.com/package/vite-plugin-svgo?activeTab=readme

wmertens avatar Jan 16 '23 15:01 wmertens

Thanks for the response @wmertens!

I'd be surprised if people don't want to optimise their SVGs. I think it could be a great selling point to have immediate, native support, since this is a performance based framework it fits right in.

It could be provided with settings to give freedom to the user to decided if/how to use it, with some standard settings by default for immediate access. As with anything, we can make it opt in or out.

DustinJSilk avatar Jan 16 '23 15:01 DustinJSilk

New image optiization uses svgo!

manucorporat avatar Jul 01 '23 11:07 manucorporat