nuxt / nuxt/icon

How to list all available custom icons

Open
#222 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
96
Avg merge
8h 12m
Merged PRs (30d)
2

Description

Usually I fetched the different icons with something like.

var icons = import.meta.glob(`.././assets/*.svg`, { as: "raw", eager: true })

for (const item in icons) {
  body.innerHTML = icons[item]
  let name = item.formatx(`../assets/$V.svg`)
  let color = body.querySelector("#color")?.getAttributeNS(null, "fill") || "black"
  let size = undefined // TODO

  result.push(await icon(`${name} c-${color}`, body.querySelector("svg") || undefined))
}

But this returns
image

Is there a better way?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the import.meta.glob custom-SVG example in the issue and inspect the repository's current custom-icon documentation or API entry points; no specific file or test is named. Determine whether the supported way to enumerate available custom icons is documented, then make the expected listing behavior and example explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.