solid-icons
solid-icons copied to clipboard
feat: build the SVG icons at compile-time
Fixes #25
This PR changes the build script to generate components that the SVG is inlined within it. This way the components are optimized and built with Solid at compile time removing the overhead of using innerHTML
on the client side. I have seen significant performance improvements after using this.
The individually built components are prebuilt with Esbuild for the Web and server to speed up compilation for the users. Workerpool is used to parallelize the post-build and get-icon stages. I have also changed the usage of sync
file system calls for the maximum build speed.
Since the bundled files are available, the changes in this PR are backwards compatible with previous versions. The individual icons can be imported as well as shown in the readme.
When will this get merged?
I have been using this in production without issues. We should wait for @x64Bits to merge it.
Hi @aminya I have been looking at the progress with this PR and I would like to advance and support the build at compile-time of the icons but keeping the current experience when using the library, it would be possible for the API to be maintained with these changes, more specifically talking of destructuring when importing them , I implemented as you suggest on the solid-icons website due to problems when importing them separately and dynamically but I don't know if it is as comfortable in the library.
Another thing that i concern about is regarding the scope of the PR, i think that we can divide the changes on some ones for be able to handle propertly, what do you think?
keeping the current experience when using the library, it would be possible for the API to be maintained with these changes, more specifically talking of destructuring when importing them
The current pull request doesn't change the API you can still import the icons you need like before.
import {FiCircle} from "solid-icons/fi"
This PR, makes the granular import also possible in addition to the previous method
import {FiCircle} from "solid-icons/fi/FiCircle"
The other big improvement is the compile-time generation of the components, which removes all the overheads.
@x64Bits is there further help needed or anything else still blocking this PR from being merged?
I think the upstream was not interested in the changes. I can publish this under a new name as it is a significant rewrite.