svgo icon indicating copy to clipboard operation
svgo copied to clipboard

Ignore malformed style attributes in minifyStyles.

Open johnkenny54 opened this issue 1 year ago • 3 comments

If a style attribute contains malformed styles, csso.minifyBlock() may throw an exception. This PR changes the code to catch the exception and leave the style value unchanged.

Resolves #1863.

johnkenny54 avatar Aug 06 '24 02:08 johnkenny54

Maybe add an option to remove malformed style? Users may want to have garbage styles removed. But it's not clear if the styles wrong or just some new feature not recognized by SVGO, so it should be optional.

GreLI avatar Aug 07 '24 19:08 GreLI

hi, any update for this PR ?

boukadam avatar Oct 16 '24 08:10 boukadam

I've pretty much given up on any bugs ever getting fixed in SVGO. I've been working on a spinoff of SVGO 4 which prioritizes lossless compression - https://www.npmjs.com/package/svgo-ll - that version handles the file in issue #1863.

svgo-ll discards the malformed property name since it's not valid. If you edit the input file to correct the property name, the property is retained, but it doesn't affect how the file is rendered.

johnkenny54 avatar Oct 16 '24 21:10 johnkenny54