You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I ran into a case where doing this actually broke previously working PNG images. It turns out that browsers are very forgiving about invalid characters in base64 strings.
For now I've commented out the three lines that remove the spaces.
Ultimately, because of the looseness of browsers supporting these types of base64 strings, I think the minification process should NOT strip spaces by default. Then we could have an option that would turn it on. That would make things more safe by default, and still give those who knew it was ok to strip out their spaces, an easy way to do that.
The text was updated successfully, but these errors were encountered:
The minification process strips out spaces from base64 strings - https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port/blob/master/src/Minifier.php#L388
But I ran into a case where doing this actually broke previously working PNG images. It turns out that browsers are very forgiving about invalid characters in base64 strings.
I put together an example of this in action at https://josephscott.org/tests/base64-spaces/
For now I've commented out the three lines that remove the spaces.
Ultimately, because of the looseness of browsers supporting these types of base64 strings, I think the minification process should NOT strip spaces by default. Then we could have an option that would turn it on. That would make things more safe by default, and still give those who knew it was ok to strip out their spaces, an easy way to do that.
The text was updated successfully, but these errors were encountered: