gulp-concat-css icon indicating copy to clipboard operation
gulp-concat-css copied to clipboard

Quotes are removed in data uri during concatenation

Open BboyKeen opened this issue 9 years ago • 5 comments

Hi,

I've just encontered a bug during concatenation of files containing inlined SVG

div {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='32' height='24' viewBox='0 0 32 24'><polygon points='0,0 32,0 16,24' style='fill: rgb%2851, 51, 51%29'></polygon></svg>");
}

produces

div {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns=http://www.w3.org/2000/svg version=1.1 width=32 height=24 viewBox=0 0 32 24><polygon points=0,0 32,0 16,24 style=fill: rgb%2851, 51, 51%29></polygon></svg>");
}

You'll notice that all single quotes are removed after concatenation, which results in bad SVG. Same problem appears with double quotes. This problem disappears when I use the option rebaseUrls : false. Is this the correct behavior ?

When using base64 encoded resource, there is no problem.

I'm using gulp-concat-css 2.2.0

BboyKeen avatar Dec 28 '15 10:12 BboyKeen

This bug seems to still be ongoing even with version 3.0

levipage avatar Jan 30 '18 22:01 levipage

So what are any other options? Is this going to be fixed?

adardesign avatar Mar 19 '18 14:03 adardesign

Ran into the same issue. Problem is within the rework-plugin-url package: https://github.com/reworkcss/rework-plugin-url/issues/7

xsonic avatar Aug 16 '18 22:08 xsonic

I lost several hours today trying to find what happened with my svg background images.

This should have been solved since many years.

migliori avatar Feb 22 '21 15:02 migliori

Still not fixed which is why I need to switch to gulp-concat then :/

Syalas avatar Apr 13 '22 07:04 Syalas