bdefore / universal-redux

An npm package that lets you jump right into coding React and Redux with universal (isomorphic) rendering. Only manage Express setups or Webpack configurations if you want to.
MIT License
460 stars 48 forks source link

SVG Loading Configuration #82

Closed cmcewen closed 3 years ago

cmcewen commented 8 years ago

In the default webpack config, SVGs get inlined as base64 images: https://github.com/bdefore/universal-redux/blob/33ac65604c605e5cb7e79c65dbae24c17a5118e7/config/webpack.config.js#L43

However, that makes it impossible to change the fill color using CSS since SVGs have to be inside an <svg> tag in order to change with styles.

Switching to this loader for SVGs allows one to add an <svg> by using dangerousSetInnerHTML, but adding it to the universal-redux.config.js config just causes the file to be loaded by both loaders instead of just the svg-inline loader.

One potential solution is to add a configuration option to choose which method of SVG loading is preferred. The other I think would be to change this merger module to overwrite loader objects if they have the same test key. Do you have any thoughts as to which makes more sense?