webalys-hq / streamlinehq-npm

The deprecated Streamline NPM package, which will be deleted on 1st November 2022.
https://medium.com/streamline-icons/how-streamline-narrows-down-its-focus-eac6fdb5c6f2
24 stars 5 forks source link

Icon naming conflict #6

Closed pareeohnos closed 3 years ago

pareeohnos commented 3 years ago

It seems that there are multiple icons that have the same name based on the main website, and as a result I'm unable to import the correct one. For example, the following two icons are both called Bin 1 on the website

streamline-icon-bin-1@140x140-2 streamline-icon-bin-1@140x140

And when viewing the relevant import statement, they both show

import Bin1 from '@streamlinehq/streamlinehq/images/streamline-light/bin-1.svg'

When the package downloads all of the icons, the folder only contains a single bin-1.svg icon (no copies, or 1.1 or anything) and as such, importing the bin icon that I actually want gives me the wrong icon.

I'm not sure how many icons this is happening to, this is jus the one I've found but I'm sure there are probably more

cbrwizard commented 3 years ago

You're right, it's an issue in this package design and it must be fixed. We will be releasing a 1.1.X version of a package soon which uses an image's name + a shortened part of its id. Eg this Bin1 image will be available to import as @streamlinehq/streamlinehq/images/streamline-light/bin-1-n8OgWa.svg. This means it will be a breaking change unfortunately :\

pareeohnos commented 3 years ago

ok great thanks, I can live with that 🙂

cbrwizard commented 3 years ago

Done: this change is implemented in version 2.0.0 https://github.com/webalys-hq/streamlinehq-npm/releases/tag/2.0.0. Please note that it introduces a couple of other breaking changes as well.

Please check it out and tell if it solves your issue.

timc13 commented 3 years ago

This doesn't seem very ergonomic. Is there somewhere that lists these ids so that we can easily import icons as needed ?

cbrwizard commented 3 years ago

It's in the app itself: go to https://app.streamlinehq.com, select a family you're interested in, then select an icon you're interested in and see the import path in the sidebar

Screenshot 2021-03-31 at 10 38 30

Another option is to use an IDE which suggests you to autocomplete a path to an image:

Screenshot 2021-03-31 at 10 39 32

I've updated README with these instructions https://github.com/webalys-hq/streamlinehq-npm/blob/master/README.md

On a side note, we're considering adding plugins to popular IDEs: Visual Studio Code and Webstorm, where you would be able to select an image and paste it in code visually. Another thing we're adding soon is a desktop app with drag&drop support.