-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Automatically include all statically-referenced icons #191
Comments
This is an interesting idea! It could definitely work, but I'm obviously hesitant to try to write code that handles all the possible edge cases here and can operate on every possible file type. For example, Astro gets a lot of support questions about Tailwind not supporting dynamic expressions because of the similar strategy they use. It's not the most intuitive behavior IMO. A similar effort by In my opinion, explicit opt-in is almost always a better choice than implicit magic. |
This would be a really neat feature but I understand that there are too many edge cases to build something like this. How are you handling explicitly listing icons on larger projects? I have quite a long list of icons in my projects, and maintaining it is a lot of effort. This is especially hard when coming back to an older project. I have to go through all the components and check what icons are used. Maybe we can do this the other way around and create a script that lists which icons are required to build the project. Let's say I remove all icons from the config file and run the build command. The build fails and I get a list of all missing icons that I can then explicitly list in my config. |
As stated above, this is a cool idea but I'm not sure we're interested in the complexity at this time. The next iteration should help because it will be importing the icons you want to use. |
Checkout these 2 PRs and feel free to provide feedback/input: |
What version of
astro-icon
are you using?v1.0.2
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I use quite a few icons from my preferred icon set, but I don't use them all. However, every single icon can be inferred from static analysis of my
./src
directory.What's the expected result?
Automatically including all icons that match the following criteria:
@iconify-json/[iconset]
/(iconset):(?<icon>[a-z-]+)/
appears anywhere within./src
[icon]
is exported from@iconify-json/[iconset]
Also include any icons explicitly listed in
astro.config.ts
.What do you think?
Link to Minimal Reproducible Example
N/A
The text was updated successfully, but these errors were encountered: