Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webpack] css-loader v4.2 breaks svg-mixer #93

Closed
makge opened this issue Aug 13, 2020 · 5 comments
Closed

[webpack] css-loader v4.2 breaks svg-mixer #93

makge opened this issue Aug 13, 2020 · 5 comments

Comments

@makge
Copy link

makge commented Aug 13, 2020

I use a postcss-move-props-to-bg-image-query plugin.
After upgrade css-loader from 3.6 to 4.2 the plugin doesn't work anymore.

css-loader v3.6: Ok!
css-loader-v3 6

css-loader v4.2: Fail!
css-loader-v4 2

@coreyworrell
Copy link

Noticing this as well.

data:image/svg+xml;base64,PHN2...dmc+#fff

@g4g1
Copy link

g4g1 commented Dec 16, 2020

Same here :/

@lada
Copy link

lada commented Feb 5, 2021

After several hours, I've found a workaround:

  1. don't use the # symbol in your css:
.img {
  background-image: url('./img.svg?fill=fff');
}
  1. Include the svg-transform-loader like this:
{
  loader: 'svg-transform-loader',
  options: {
    transformQuery(query) {
      if (query.fill) {
        query.fill = `#${query.fill}`;
      }
    },
  },
},

Hope it helps.

@g4g1
Copy link

g4g1 commented Feb 10, 2021

Looks like its ok in css-loader v5.0.2
webpack-contrib/css-loader#1261

@makge
Copy link
Author

makge commented Mar 2, 2021

Yes, it works now with css-loader v5.0.2
Thanks g4g1!

@makge makge closed this as completed Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants