madskristensen / ImageOptimizer

A Visual Studio extension
Other
162 stars 40 forks source link

Feature Request: SVG Optimizer #19

Open coliff opened 8 years ago

coliff commented 8 years ago

Love this extension for bitmap images. Would love to see support for optimising SVG built-in.

Nettsentrisk commented 7 years ago

Implementing SVGO to optimize SVGs should be a no-brainer :)

JavierCanon commented 5 years ago
  1. https://github.com/svg/svgo
  2. https://hacks.mozilla.org/2015/03/optimising-svg-images/

the simple method is minify and remove unused data from de xml (svg), the web server ex. IIS can compress the .svg files with zip

markvantilburg commented 2 years ago

Compressor.cs

Change supported list to: private static readonly string[] _supported = { ".png", ".jpg", ".jpeg", ".gif", ".svg" };

Inside this method add svg option: private static string GetArguments(string sourceFile, string targetFile, bool lossy)

case ".svg": { return $"/c npx svgo \"{sourceFile}\" -o \"{targetFile}\""; }

But the user would need to have npm / npx and svgo installed for this to work

@madskristensen do you have an idea?

madskristensen commented 2 years ago

@markvantilburg In the vast majority of cases, they won't have those npm packages installed globally

markvantilburg commented 2 years ago

I see the old web compiler includes node js packages for compiling less files, could that be an option for this plugin? I could not find a .exe file to compress svg files.