Should not process urls with protocol data:
inian opened this issue · comments
Right now URLs in css like
.haha {
filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale")
}
gets changed to
.haha {
filter: url("data:image/svg+xml;utf8,<svg xmlns=http://www.w3.org/2000/svg><filter id=grayscale><feColorMatrix type=matrix values=0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0/></filter></svg>#grayscale");
}
when run with the plugin with no transformations to the URL.
The bug is that the quotes get stripped off, leading to an invalid inline SVG
👍
Would be nice for it to leave data urls alone
You could add a test in your rework function to check for the data protocol. If present just the return the original url:
if(url.indexOf('data:image') >= 0) return url;
Please check if #10 helps
Can someone get to merging the above PR? This is causing production issues for me and it would be nice if I didn't have to point to my own fork with this patched
Would like to see this merged, too.
Took care of the remaining remark in #10. Let's see if it gets merged and a new version released.
Posted this on another issue but will put it here as well. Since there are no commits on since 2015 I do not think it is maintained any longer. So I wouldn't get your hopes up that any PRs will be merged.
After using a forked version for a little while I ended up switching to use PostCSS Url which is still maintained. If you are already using the popular Autoprefixer then you are also using PostCSS which makes adding PostCSS Url pretty easy.