Conversation
|
Just asking ... can you use |
|
That's for sure the next step! |
|
Hello, thank you for this implementation! To have thought a little about this functionality, I propose the following modification: Put an @ before the name of the alias This allows you to add an AliasNotFound error which would be easier to debug, and to only check the configuration file when calling an alias. |
|
@Xbirdfr the problem with that is that it introduces a new convention that all users of UX Icon must learn, which causes friction. In any case, is |
|
@javiereguiluz I understand that, but as Icones Alias will be a new feature, I will cause less friction Actually, if With an @ we clearly know if we want an alias or not while using ux icon, and allow a better readability and debugging. But it's maybe too much and I understand this, but I really think this will be a good way to handle alias |
@javiereguiluz yep absolutely! And we decided to avoid it in the TwigComponent shared by bundles, so it would be a bit strange to introduce it here. |
|
@Xbirdfr This is precisely what i did not want to handle for now. We have the Full disclosure: i will open a PR after this one to implement the long-waiting "configuration per icon sets/directorys" ... so let's talk about namespaces aliases afterwards 😅 I promised the simple aliases long time ago, and we have been poked again recently ... so this is more the context of this PR :) Personally, I will use the aliases in several projects, to have simple "one-word-domain-icon-names" for the 10/12 most used icons (which come from different sets -- excluding here any partial mapping). Something like this: # config/packages/ux_icons.yaml
ux_icons:
aliases:
# Logos
github: 'simple-icons:github'
twitter: ' pajamas:x'
php: 'bxl:php'
# Actions
delete: 'tdesign:delete'
add: 'material-symbols:add'
# ... |
799ce57 to
1463b5f
Compare
|
Simon, thanks for yet another nice feature contribution! |
This PR introduce a first implementation of this feature, asked in #1767
Icon aliases can now be defined in the bundle configuration, to improve the DX for most used icons in a project (logo, socials, ...)
Now
{{ ux_icon('dots') }} {# is the same as #} {{ ux_icon('clarity:ellipsis-horizontal-line') }}Or... with the HTML syntax