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

Cannot mark an icon as optional and allow it to silently be omitted #244

Closed
dhruvkb opened this issue Oct 22, 2024 · 3 comments
Closed

Cannot mark an icon as optional and allow it to silently be omitted #244

dhruvkb opened this issue Oct 22, 2024 · 3 comments

Comments

@dhruvkb
Copy link

dhruvkb commented Oct 22, 2024

What version of astro-icon are you using?

1.1.1

Astro Info

Astro                    v4.16.2
Node                     v20.16.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/mdx
                         watchPlugins
                         astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I want to mark an icon as optional, i.e. the component should not raise an error if the icon does not exist in the iconDir directory. Currently if such an icon is referenced, the error takes over the whole page:

image

What's the expected result?

The component should log the error but not take down the entire site like it does currently.

Link to Minimal Reproducible Example

N/A

@stramel
Copy link
Collaborator

stramel commented Oct 22, 2024

What's the use-case of an optional icon?

@dhruvkb
Copy link
Author

dhruvkb commented Oct 23, 2024

I have icon names coming from an API where I want to supply some icons but let other icons be silently hidden.

@stramel
Copy link
Collaborator

stramel commented Dec 27, 2024

After thinking about this further, I don't think this is something that we're interested in pursuing at this time. We're moving away from handling local files and going to be deferring this to Astro. This would make it pretty easy to do an implementation of this.

Checkout these 2 PRs, would love feedback/input.

@stramel stramel closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants