netguru / create-react-app

Create React apps with no build configuration.
MIT License
14 stars 6 forks source link

Handle SVGs as JSX. #38

Closed pawelnvk closed 6 years ago

pawelnvk commented 6 years ago

This is proposal of optional way of handling importing SVGs as JSX with usage of svg-react-loader.

papermana commented 6 years ago

The separate variable loaders would be a good idea normally, but in this case it's going to complicate merging changes from upstream. ☹️

What do you think about doing it like so? It's maybe a little bit hacky...

[
  foo,
  bar,
  someEnvVar ? baz : null,
  qun
].filter(x => x)
pawelnvk commented 6 years ago

I wanted to omit such hacky solutions, but when the cause is good I can't say no 😄 I will change it.

papermana commented 6 years ago

Alternatively, since we already only load *.inline.svg files as components, we might not use an env var to decide at all.