I use Webpack to load SVG icons. Most icons have some CSS associated with it. I would like to keep styles for each icon in separate file. So it's needed some convenient way to include it in CSS bundle if icon is imported. For example
import arrowIcon from 'icons/arrow.svg'
must:
1) load 'icons/arrow.svg' using my SVG loader
2) load 'icons/arrow.svg.css' using my CSS loader
My attempts
I could use multi-loader
for that, but I don't know how to modify resource path arrow.svg
=> arrow.css
to pass it to CSS loader. I could use NormalModuleReplacementPlugin
for that, but it seems to modify path for both loaders.
Also I could write my own loader which modifies path and invokes CSS loader, but don't know how to properly execute loader inside loader