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

[Icons] Icons are missing xmlns attribute #2561

Open
eigentor opened this issue Feb 10, 2025 · 6 comments
Open

[Icons] Icons are missing xmlns attribute #2561

eigentor opened this issue Feb 10, 2025 · 6 comments
Labels
Icons Status: Reviewed Has been reviewed by a maintainer

Comments

@eigentor
Copy link

Reporting this as a bug, even if it may be I use the ux-icons bundle not in the indended fashion. Feel free to change issue type if this is the case.

I installed the UX icons package and use it to just download the icons with like
console ux:icons:import flowbite:user-solid and reference them as background images with css.
The icons download just fine but I was surprised the browsers could not render them. It appears the xmlns attribute is missing
xmlns="http://www.w3.org/2000/svg" so the browsers do not render the icons as icons but as xml.
This happens independent of what library I use. I tried akar-icons, devicons and fa6-brands.
While in my case i can add the xmlns manually, the point of using ux-icons for me is not to manually wrangle files but to just download and enjoy.

As stated, maybe I am using it wrong :)

@eigentor eigentor added the Bug Bug Fix label Feb 10, 2025
@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Feb 10, 2025
@seb-jean
Copy link
Contributor

Related to #2345

@eigentor
Copy link
Author

O.K. I could reopen the other issue. Should I do that and close this one? What I am guessing is everyone is using the icons only as inline svgs so the xlmns issue might not be one.

@smnandre
Copy link
Member

You can also define default attributes via the bundle configuration, and only need to do it once for all your icons :)

@smnandre smnandre added Icons Status: Reviewed Has been reviewed by a maintainer and removed Bug Bug Fix Status: Needs Review Needs to be reviewed labels Feb 11, 2025
@smnandre smnandre changed the title UX-Icons: Icons are missing xmlns attribute [Icons] Icons are missing xmlns attribute Feb 11, 2025
@eigentor
Copy link
Author

eigentor commented Feb 11, 2025

Now this sounds like a plan :)
I tried fiddling with config, here is my config:
config/packages/ux_icons.yaml

ux_icons:
    icon_dir: '%kernel.project_dir%/assets/willi'
    default_icon_attributes:
        xmlns: http://www.w3.org/2000/svg
        fill: red

While I managed to change the icon_dir, which proves the config is read, any attributes I add to default_icon_attributes are not respected, all when using
console ux:icons:import

@smnandre
Copy link
Member

Oh, the options are handled on render time.. if you download them and serve them on your own, I have no idea right now... This was not on our mind when we worked on the bundle, but it is a 100% legit query :)

@CodeDuck42
Copy link

An option to preserve/set the xml namespace would be really nice. The icon files themselves would be svg complient and third party tools can use/view them. i.e. currently PhpStorm cannot show a preview of those downloaded files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Icons Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

5 participants