unplugin / unplugin-icons

🤹 Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
3.65k stars 131 forks source link

How to auto import icon set with plural names? #335

Closed nova1751 closed 6 months ago

nova1751 commented 6 months ago

Describe the bug

I'm very confused about how to auto-import icons like the picture below,I tried the forms like <i-gravity-ui-cloud-gear /> and <i-GravityUI-cloud-gear /> but it didn't work.

Snipaste_2023-12-17_21-25-19 Snipaste_2023-12-17_21-30-58

Reproduction

1

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 1.90 GB / 15.71 GB
  Binaries:
    Node: 16.20.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.4 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.12.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.77)
    Internet Explorer: 11.0.22621.1

Used Package Manager

pnpm

Validations

userquin commented 6 months ago

Use : to separate collection and icon: <i-gravity-ui:cloud-gear />

https://github.com/unplugin/unplugin-icons/pull/316

nova1751 commented 6 months ago

Use : to separate collection and icon: <i-gravity-ui:cloud-gear />

316

It doesn't seem to work though,it still doesn't render correctly.

Snipaste_2023-12-17_21-48-23
userquin commented 6 months ago

what fw are you using?

nova1751 commented 6 months ago

what fw are you using?

    "vite": "^4.4.9",
    "vue": "^3.3.12",
userquin commented 6 months ago

@nova1751 it seems gravity-ui collection missing (should be very new), add it to resolver options via enabledCollections: ['gravity-ui'], to IconResolver: https://stackblitz.com/edit/unplugin-unplugin-icons-rupzop?file=vite.config.ts,App.vue

userquin commented 6 months ago

Next time check examples readme page to provide a playground.

nova1751 commented 6 months ago

Next time check examples readme page to provide a playground.

Oh, I see.Thanks for your help.