Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why not just use the legacy version?
We had problems running the lib in worker. That was it. But then, as I started to look at it, I discovered that we are there is room for improvement.
Bundling
While
gulp
is great and allows you to build the library,vite
is the standard these days. With the old implementation, the library loaded all the features of svg into a single DOM element (usingdom-parser
) and from there, depending on the hash, it selected the features for the fiven hash. Then it ensabmages all the selected elements together with a predefined background and colors and runs an optimization process on each render.With the new approach, we run
svgo
with some defined plugins in dev and write the optimized svg to the folder. Then at runtime we just ensamble the selected optimized features and return the SVG. After the selected features have been retrieved, we just ensamlbe the SVG and return it. We don't usedom-parser
and we don't need to optimize the SVG at runtime.Docs
I am planning to make a small README with a basic usage of the library, but I also prepared a page for the developer center:
Playground
I have created a Vue 3 application that can be used for local testing, but also as a playground. We need to enable deployment to GitHub pages from GitHub actions and the link should work.
Performance Comparison
Breaking changes
See Migration Guide here
Discontinued functions
Please check the functions that have NOT been migrated: https://deploy-preview-78--developer-center.netlify.app/build/ui/identicons#discontiuned-functions
TODO
solves #2, #12, #17