https://www.npmjs.com/package/octicons
Import as plain text:
import doma from 'doma';
import alertIcon from 'octicons/build/svg/alert.svg';
document.body.append(doma.one(alertIcon))
Or as JSX with https://github.com/janjakubnanista/svg-jsx-loader
import alert from 'octicons/build/svg/alert.svg';
document.body.append(alert());
There's also the official @githubprimer/octicons-react package but I don't think it's being built+published correctly yet.
Also possibly: https://github.com/siddharthkp/jsxo but it needs Babel
Why change it now though? Our way is already working fine. GitHub might also sometimes use new icons that are not yet added to that package.
For the same reason why we prefer to npm install features instead of maintaining them in the current project.
If a new icon isn’t present (🤷♂️) we can still copy-paste it (like we did before) directly in the feature that needs it.
We mentioned this a long time ago but never did it. Not a big deal but it seems like the obvious thing to do: require, not copy-paste
Alright then 👍
@bfred-it Seems like https://www.npmjs.com/package/@githubprimer/octicons-react is being published regularly now. Probably we can use it. What do you think?
Sadly they use too much React stuff in there, it's bloated for us
Most helpful comment
Sadly they use too much React stuff in there, it's bloated for us