Open
Description
Looking at svgo --show-plugins
disabled plugins are marked as such.
$ svgo --show-plugins | grep tyle
[ convertStyleToAttrs ] converts style to attributes
[ inlineStyles ] inline styles (additional options)
[ mergeStyles ] merge multiple style elements into one
[ minifyStyles ] minifies styles and removes unused styles
[ removeStyleElement ] removes <style> element (disabled by default)
It looks like convertStyleToAttrs
is enabled by default, but it is not.
To Reproduce
- Prepare
circle.svg
:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><circle cx="10" cy="10" r="10" style="fill:red"/></svg>
-
Run
svgo circle.svg -o circleout1.svg
, resulting in no change. -
create
svgo.config.mjs
:
export default {
plugins: [
{
name: 'preset-default',
},
'convertStyleToAttrs'
],
};
- Run
svgo circle.svg -o circleout2.svg
, resulting in0.112 KiB - 5.2% = 0.106 KiB
and the following file:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><circle cx="10" cy="10" r="10" fill="red"/></svg>
Expected behavior
convertStyleToAttrs should be enabled by default or
--show-plugins
should state "(disabled by default)"
Desktop:
- SVGO Version 4.0.0
- Node.js Version v22.16.0
- OS: Windows 10 10.0.19045.5965