Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict involving icons that share the same name but have different paths (solid/outline). #135

Open
avim101 opened this issue May 24, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@avim101
Copy link

avim101 commented May 24, 2023

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

I have come across a conflict related to registering icons that share the same name but have different paths, such as "arrowUp" from the "solid" and "outline" directories. The issue arises when the registration process checks if the name already exists.

  register(icons: SvgIconType | SvgIconType[]) {
    for (const { name, data } of Array.isArray(icons) ? icons : [icons]) {
      if (!this.svgMap.has(name)) {
        this.svgMap.set(**name**, new SvgIcon(data));
      }
    }
  }

Expected behavior

should be able to handle icons with the same name but different paths in a way that allows both versions to coexist.
Resolution Suggestions:
add the possibility to add prefix / postfix to icon output name when generation

export interface Config {
  srcPath: string;
  outputPath: string;
  svgoConfig: { plugins: any[] };
  prefix?: string;
  postfix?: string;
  rootBarrelFile?: boolean;
  rootBarrelFileName?: string;
  iconExportedNamePrefix?: string;
  iconExportedNamePostfix?: string;
}
export const arrowUpIcon = {
    data: `...`,
    name: 'arrow-up' as const
};

will be

export const arrowUpIcon = {
    data: `...`,
    name: 'arrow-up-**solid**' as const
};

Minimal reproduction of the problem with instructions

  1. Register icons with the same name but different paths, such as "arrowUp" from both the "solid" and "outline" directories.

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  
Mac
Others:

@NetanelBasal
Copy link
Member

You're welcome to submit a PR

@NetanelBasal NetanelBasal added the enhancement New feature or request label Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants