airbnb/babel-plugin-inline-react-svg

Need `includePattern` as option

Aperta

#62 aperta il 5 giu 2019

 (11 commenti) (0 reazioni) (0 assegnatari)JavaScript (90 fork)github user discovery
enhancementhelp wanted

Metriche repository

Star
 (474 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

My issue is that we want to use this babel transform just for icons that we want to style - inline icons that should have the same color as surrounding text, etc.

On the other hand, we'd like to use webpack's url-loader to handle all larger "illustration" SVGs. We would rather put those in img tags and let them be cached by the browser and not have them in our javascript bundle.

To do so, an includePattern could be used that would only use this babel transform on (for example):

  • *.icon.svg
  • */icons/*.svg

Thoughts? I'm about to make a PR.

Guida contributor