-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Merge duplicate defs #802
Comments
I guess, it can be. However, I think it's a rare case, so it will not give much profit in general. There is no same plugin. mergePaths concatenates sibling paths with same params, but you'll have to track IDs. |
@GreLI thanks for your responses. I suppose there are two general scenarios that could be looked at here:
Both will require the ability to track IDs, as you say. My questions are:
|
|
Yes, useless defs are being removed by |
I want this feature. These duplicates are usually generated by copy&paste in the SVG editor. |
Yes please, Inkscape creates lots of duplicate defs. |
+1. I do a lot of copy/paste and generate a huge lot of duplicate defs. My document takes a lot of time to load! :-S Would be nice to optimize that. |
My +1, very useful to remove duplicate raster images (for exmaple created by inkscape or poppler), significantly reducting some svg-s. |
I also find SVGs in the wild with excessive use of duplicate <defs>
<image ns1:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAABCAIAAABR8BlyAAAABmJLR0QA/wD/AP+gvaeTAAAADklEQVR42mO4lZZGNgIA9wYg+cZ4RWoAAAAASUVORK5CYII=" id="f" width="20" height="1" x="0" y="0" />
...
</defs> with hundreds of repetitions. |
An Inkscape document I created used mid-markers on paths.
After running SVGO I see:
This particular document has 15 duplicate marker definitions. Merging them reduces the file size by 30%.
Would merging these duplicate markers be a safe optimisation for SVGO? Are there similar examples I can look at to help build a PR?
As I said elsewhere, I'm interested in making some contributions to this project. I'd like some feedback on ideas before putting together PRs.
The text was updated successfully, but these errors were encountered: