x64Bits / solid-icons

The simplest way to use icons in SolidJS
https://solid-icons.vercel.app
MIT License
284 stars 18 forks source link

feat: build the SVG icons at compile-time #28

Open aminya opened 1 year ago

aminya commented 1 year ago

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.

image

iosiftalmacel commented 1 year ago

When will this get merged?

aminya commented 1 year ago

I have been using this in production without issues. We should wait for @x64Bits to merge it.

x64Bits commented 1 year ago

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.

x64Bits commented 1 year ago

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?

aminya commented 1 year ago

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.

jcramb commented 3 months ago

@x64Bits is there further help needed or anything else still blocking this PR from being merged?

aminya commented 3 months ago

I think the upstream was not interested in the changes. I can publish this under a new name as it is a significant rewrite.