webpack-contrib/svg-inline-loader

Make default class name optional

joaocunha opened this issue · 2 comments

We currently use a mix of IcoMoon and SVGs, and the stylesheet generated by IcoMoon uses the following selector: [class^="icon-"], [class*=" icon-"] { ... } - which obviously collides with icon-svg. We can't change that prefix as it would affect the whole application.

https://github.com/sairion/svg-inline-loader/blob/master/lib/component.jsx#L25

Hello! Thanks for suggestion. I'm thinking of just remove default class, move the component to diffrent package, and leave the component here for compatibility-wise reason (with console message to suggest migration).

Before it happens, you can pass 'defaultClassName' prop to remove the default icon-svg class. If you find it awful to do it all over the place, you can wrap it with wrapper component like:

class IconSVG2 extends Component {
    render () {
         return <IconSVG defaultClassName="" src={...} />
    }
}

Thanks for report!

I removed defaultClassName from newly packaged component: https://github.com/sairion/svg-inline-react

and IconSVG component is deprecated in this package.