Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore malformed style attributes in minifyStyles. #2054

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johnkenny54
Copy link
Contributor

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.

@GreLI
Copy link
Member

GreLI commented Aug 7, 2024

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.

@boukadam
Copy link

hi, any update for this PR ?

@johnkenny54
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read properties of undefined (reading '0')
3 participants