2
Vote

The data:image/png;base64, is being removed.

description

I am using the WebGrease package directly in some custom code
// Setting for the minifier
CssSettings settings = new CssSettings
{
    CommentMode = CssComment.None,
    TermSemicolons = false,
};
// Minify the text.
cssText = new Minifier().MinifyStyleSheet( cssText, settings );
We found that the CSS minifier does not process the base64 embedded image data elements correctly if there is a space (or more than one space) following the comma after the ;base64, element.

.test { background-image: url( data:image/png;base64, iVBORw0KGgoAAAANSUhEU6G1eRcsVuD2kXAAAAAElFTkSuQmCC ); }

will return

.test{background-image:iVBORw0KGgoAAAANSUhEU6G1eRcsVuD2kXAAAAAElFTkSuQmCC)}

The data: elements have been removed. Note: The encoded values has been truncated to keep the example readable.

If you remove the space following the comma then it works correctly.

-thanks

comments

hunterb46 wrote Feb 2, 2016 at 12:35 PM

I'm having a similar issue with embedded blocks,

.test
{
background-image:url(<%=WebResource("Test.Resource.Image.png")%>);
}

is changed to

.test{background-image:("Test.Resource.Image.png")%>)}