Open kmohrf opened 3 years ago
@kmohrf Maybe you can use aliases in combination with enable only your collection:
IconsResolver({
// ===> this is optional, default enabling all the collections supported by Iconify <===
enabledCollections: ['mdi']
})
EDIT: you can see an example on examples/vite-vue3
package/directory on this repo.
@kmohrf just use this:
Icons({
compiler: 'vue3',
}),
Components({
dts: true,
resolvers: [
IconsResolver({
prefix: '',
alias: {
sys: 'system-uicons',
},
enabledCollections: ['system-uicons'],
}),
],
}),
then
<sys-plus/>
EDIT: or just try this one, maybe just works:
Icons({
compiler: 'vue3',
}),
Components({
dts: true,
resolvers: [
IconsResolver({
prefix: '',
alias: {
icon: 'system-uicons',
},
enabledCollections: ['system-uicons'],
}),
],
}),
then
<icon-plus/>
Yeah I thought about that too and it probably works, but has very weird semantics because then I have <icon-plus/>
and <mdi-something/>
which would confuse others working on the same project. Apart from that I don’t want to restrict the enabled collections I just want one of them to be the default.
I don’t think this is a must have. I currently have aliased system-uicons
to sui
which is probably fine, I just thought it makes a reasonable addition configuration-wise. If you think this is over-engineered feel free to close it :).
PR welcome if you really need that.
Hi,
I was looking for something like a
defaultCollection
option for theIconsResolver
but that doesn’t seem to exist yet. I usually try to stick to one icon collection in any single project, simply because the general art style is consistent and only use icons from other collections as kind-of last resort (though unplugin-icons definitively makes this much easier, thank you!).Right now I’ve been using the
system-uicons
and it gets a little tedious to write<icon-system-uicons-plus/>
when it probably could be<icon-plus/>
instead and only if I want to deviate from my default I’d have to write something like<icon-mdi-account/>
.I thought I could get away with
but… curse this sudden but inevitable betrayal :).
Thank you for time & work,
Konrad
versions used: vite@2.5.10 unplugin-icons@0.11.3