https://github.com/ryanmcgrath/react-iconpack
react-iconpack is essentially a suite of plugins:
- A Babel plugin to track <Icon> usage across your builds
- A Webpack or Browserify plugin to inject SVG source as a module
- A React Component that gets injected to handle
displaying icons from the aforementioned module
The build on npm is the old one, which the docs are still more or less current with. The code in the repository linked above is the updated version to work with Webpack; while it does work, it falters when caching is enabled on the upstream stuff (i.e, Webpack/Babel/etc). It's probably because I've just been staring at it for too long but I'd be interested in anyone's thoughts on integrating with said cache setups - the crux of the issue is that the Babel plugin won't run on already-built and cached modules (which makes sense, but is annoying in this particular case).The rationale for the project is that I don't want to have to specifically import an icon at the top of each file just to display it - I'd rather just write the <Icon ... /> JSX and have it auto-pulled in. It rides on the mental ease of JSX all being inline (not interested in the for-or-against JSX debate).
Apologies if the formatting is off on this, I can never remember how it works on HN.