You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
If an icon pack is installed @iconify-json/[iconset]
And the pattern /(iconset):(?<icon>[a-z-]+)/ appears anywhere within ./src
And [icon] is exported from @iconify-json/[iconset]
Include it in the bundle.
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:
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 @antfu called PurgeIcon has since been abandoned, I assume due to the maintenance burden of such complex behavior.
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.
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: