Refined-github: Use package octicons instead of including icons.tsx

Created on 1 Feb 2019  ·  5Comments  ·  Source: sindresorhus/refined-github

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

help wanted meta

Most helpful comment

Sadly they use too much React stuff in there, it's bloated for us

All 5 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mareksuscak picture mareksuscak  ·  3Comments

sompylasar picture sompylasar  ·  3Comments

hkdobrev picture hkdobrev  ·  3Comments

alexanderadam picture alexanderadam  ·  3Comments

vanniktech picture vanniktech  ·  3Comments