nuxt / nuxt/icon

Feature request: A way to manage custom SVGs that are nested inside folders.

Open
#75 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi there, thanks for the cool module.

I was wondering if it is possible to nest custom SVG icons inside folders?

Editing OP to make it more clear:


After some experimenting with the playground in the repo I understand the intended pattern now.

  1. Default pattern
// Assuming: `components/global/MyIcon.vue`

<Icon name="MyIcon" /> 
  1. If you want to have <Icon> load an SFC that is nested in folders - that's easy:
// Assuming: `components/global/CoolStuff/MyIcon.vue`

<Icon name="CoolStuffMyIcon" /> 
  1. However, if you have an elaborate set of custom icons (.svg extension) that are organized in folders, you would currently need an individual .vue icon to go along with every single one.
// Assuming: `{public|assets}/icons/brand/MyIcon.svg
// Assuming: `components/global/icons/brand/MyIcon.vue`

// Assuming: `{public|assets}/icons/brand/MyOtherIcon.svg
// Assuming: `components/global/icons/brand/MyOtherIcon.vue`

<Icon name="IconsBrandMyIcon" />
<Icon name="IconsBrandMyOtherIcon" />

// etc.

This means you need to manage a folder of SVGs as well as their matching SFCs.

Is there a solution?

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 repository playground and trace how nested SFC names and custom SVG icons are discovered and resolved. Define completion as allowing SVGs in nested folders to load through without requiring a matching Vue SFC for each file.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.