madskristensen / BundlerMinifier

Visual Studio extension
Other
615 stars 172 forks source link

{clip-path:url(%23clip-path);} in SVG file is corrupted by minifying #559

Open smithery opened 3 years ago

smithery commented 3 years ago

Installed product versions

Description

The %23 is replaced by # in the {clip-path:url(%23clip-path);} causing the image to not be displayed in browser

Steps to recreate

Original CSS text

.role-rider1 { background-image: url('data:image/svg+xml;charset=utf8,'); }

is minified to

.role-rider1{background-image:url('data:image/svg+xml;charset=utf8,')}

The .cls-3{clip-path:url(%23clip-path);} in the original is minified to .cls-3{clip-path:url(#clip-path);}

The %23 is changed to # which corrupts the construct and the final image is not displayed in any browser.

Current behavior

While the %23 is reduced to # to save two (2) characters, it corrupts the construct within the SVG causing the image to not be displayed.

Expected behavior

By not replacing the %23 with # the construct will not be corrupted and the image will continue to be properly displayed. The only way to correct this is to do a search and replace on the actual .nin.css file to replace the corrupted class definition with the original string.