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

Support registering an icon with a path to a file on disk #29

Open
cbirdsong opened this issue Apr 10, 2023 · 1 comment
Open

Support registering an icon with a path to a file on disk #29

cbirdsong opened this issue Apr 10, 2023 · 1 comment
Labels
Enhancement New enhancement or feature request.

Comments

@cbirdsong
Copy link
Contributor

It would be nice if you could supply a file path when registering an icon instead of having to cram the SVG markup into a Javascript variable.

@ndiego ndiego added the Enhancement New enhancement or feature request. label Apr 14, 2023
@JiveDig
Copy link

JiveDig commented Dec 26, 2024

I have a working version of this in a custom plugin. Here is the idea I'm playing with:

  1. Creates a public endpoint for any theme icons in mytheme/assets/icons.
  2. Recursively looks for icons (limited to 2 dirs depth):
mytheme/assets/icons/icon1.svg
mytheme/assets/icons/some_dir/icon2.svg
mytheme/assets/icons/some_dir/some_subdir/icon3.svg
  1. It adds categories based on the dir hierarchy.

On local, it's take ~600ms to load 4354 icons from FontAwesome and Heroicons. Not sure how it would handle a large icon set on a real server.

Loading 1 Heroicons set (324 icons) takes ~150ms.

I'd love to have this filter only run when initiating the icon block, right now it runs immediately when the editor is loaded.

Anyone care to play with this code? Should we get it into a PR?

CleanShot 2024-12-26 at 16 54 47@2x

CleanShot 2024-12-26 at 16 54 08@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New enhancement or feature request.
Projects
None yet
Development

No branches or pull requests

3 participants