Open genffy opened 7 months ago
Start a new pull request in StackBlitz Codeflow.
add prefix
add prefix
The option of componentPrefix
was well worked for demo, but not suitable for real app.
componentPrefix
is there to solve these type of problems, any ui library should add a prefix to avoid collisions, if you're removing that prefix when using this library, how do you expect us to be able to detect a collision here?
For example, if you add Vuetify and you use VXXX in your component names, it is not a Vuetify bug when using Vuetify resolver, change your component names (in this example the components have a fixed name, here, we expose componentPrefix
to allow dynamic names/prefix from configuration).
Take a look at any ui resolver in unplugin-vue-components
@userquin the prefix
cannot solve the this issue(nuxt3) scenario, especially the app with a large number of components, it can't exclude multiple icon-sets
.
Actually the options of enabledCollections
can worked, and set some of what you used icon prefix, but its should not be too simple like la
, fa
...
The another solution is add strict
option, when set true
to force strict matching with -
suffix for all collections. The main change is on this https://github.com/unplugin/unplugin-icons/pull/327/files#diff-0d2f46f3b329944abf82b98bdebe5220e48742c8868011ed9b35b592f72b0fedR112
What do you mean? you only need to remember to not including components starting with I
in your components folder.
If that's a problem, you can use UnoCSS Icons Preset, you don't need any vue component, just use css classes (you also have UnoCSS integration for Nuxt ).
Describe the bug
When use ViteComponents and IconsResolver, and if the component name include the string that is defined in colloections(default is icon-sets.json), and the
components.d.ts
file will get error path.eg:
LayoutHeader => LayoutHeader: typeof import('~icons/la/yout-header')['default']
Circle: typeof import('~icons/ci/rcle')['default']
Because the la and ci are all both included by icon-sets prefixThe mini reproduction is a nuxt3 example.
Reproduction
https://stackblitz.com/edit/nuxt-starter-mrqmcy?file=components.d.ts
System Info
Used Package Manager
pnpm
Validations