ngneat / svg-icon

👻 A lightweight library that makes it easier to use SVG icons in your Angular Application
https://netbasal.com
MIT License
257 stars 35 forks source link

[Feature Request] Generate standalone IconComponent per icon type #98

Closed Lonli-Lokli closed 1 year ago

Lonli-Lokli commented 2 years ago

<!-

I'm submitting a...


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

Current behavior

One single IconComponent with support for icon types

Expected behavior

Multiple IconComponents, declared as standalone. They will not have input iconType, but will directly use SVG. As they will be declared as standalone, it will be a tree shakable solution as well

NetanelBasal commented 2 years ago

Do you want to create a PR?

Lonli-Lokli commented 2 years ago

How do you think should look like original icon, as a handlebar template?

NetanelBasal commented 2 years ago

The issue with your suggestion, in general, is that it will increase the bundle code size because we generate additional components.

NetanelBasal commented 2 years ago

In the current implementation we support tree-shaking, so what's the benefit of your suggestion?

Lonli-Lokli commented 2 years ago

It allows usage of specific icons - instead of specifying key='leftArrow' we can use LeftArrowIcon, without any registry.

Also it will be safer, now key of svg-icon is string, not the actual icon type

NetanelBasal commented 2 years ago

I understand this, but on the other side, it will increase your bundle size. I don't mind leaving this decision to the consumer.