Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,33 @@ export default defineNuxtConfig({
> [!NOTE]
> If you are running on Nuxt 4 with the new `app` directory, the assets directory is `'./app/assets/*'` instead of `'./assets/*'`.

#### Using as an Extendable Layer

If your Nuxt project is designed to be used as an extendable layer by other projects, you should use `createResolver` from `@nuxt/kit` to ensure paths resolve correctly relative to your layer's directory:

```ts
import { createResolver } from "@nuxt/kit"

const { resolve } = createResolver(import.meta.url)

export default defineNuxtConfig({
modules: [
'@nuxt/icon'
],
icon: {
customCollections: [
{
prefix: 'my-icon',
dir: resolve('./assets/my-icons'), // <-- use resolve() for layer compatibility
},
],
},
})
```

This ensures that when another Nuxt project extends your layer, the icon paths will correctly resolve to your layer's directory rather than the consuming project's directory. Without using `resolve()`, the paths would be relative to the project that extends your layer, causing icons to not be found.


Then you can use the icons like this:

```vue
Expand Down