diff --git a/plugins/cleanupStyleAttributes.js b/plugins/cleanupStyleAttributes.js index 59b7817..d7b8a1c 100644 --- a/plugins/cleanupStyleAttributes.js +++ b/plugins/cleanupStyleAttributes.js @@ -1,5 +1,6 @@ import { getStyleDeclarations } from '../lib/css-tools.js'; import { LengthOrPctValue } from '../lib/lengthOrPct.js'; +import { OpacityValue } from '../lib/opacity.js'; import { writeStyleAttribute } from '../lib/svgo/tools.js'; import { visitSkip } from '../lib/xast.js'; import { @@ -130,6 +131,14 @@ export const fn = (root, params, info) => { newValue.value = minified; } break; + case 'fill-opacity': + case 'opacity': + case 'stop-opacity': + case 'stroke-opacity': + { + newValue.value = OpacityValue.getOpacityObj(v.value); + } + break; } newProperties.set(p, newValue); } diff --git a/test/plugins/cleanupStyleAttributes.18.svg.txt b/test/plugins/cleanupStyleAttributes.18.svg.txt new file mode 100644 index 0000000..10fddd1 --- /dev/null +++ b/test/plugins/cleanupStyleAttributes.18.svg.txt @@ -0,0 +1,21 @@ +Minify opacities. + +=== + + + + + + + + + +@@@ + + + + + + + +