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

feat(moveElemsAttrsToGroup): improve attribute flow #1895

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

KTibow
Copy link
Contributor

@KTibow KTibow commented Dec 21, 2023

Sometimes there is a svg or a g that has a redundant attribute, like this:

<svg fill="red">
    <rect fill="blue"/>
    <circle fill="blue"/>
</svg>

These can be removed.
And sometimes the defaults are inefficient, like this:

<svg>
    <g fill="red">
        <path/>
        <rect fill="blue"/>
        <circle fill="blue"/>
    </g>
</svg>

The default can be changed to something more efficient. This PR does that.

* This would be even better if it moved attributes from/to svg, but I'm not sure if I should implement that.
* If the default-changing is too much, I'm fine removing everything except for the redundant attribute remover.

Results

Join this with #1894 for better performance on icon sets. On Isometric Madness compared to current SVGO, this does -3221 bytes without multipass and -4343 with.

@KTibow KTibow changed the title feat(moveElemsAttrsToGroup): remove attributes that are overriden by children feat(moveElemsAttrsToGroup): improve attribute flow Dec 21, 2023
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.

1 participant