minify
minify copied to clipboard
Replacing 'white' and 'black' to '#fff' and '#000' breaks fonts
Hi,
I don't see the point of https://github.com/matthiasmullie/minify/pull/258 but most probably after that, fonts are being rewritten as well.
For example:
@font-face { font-family: "Circular Std Black"; src: url(my_black_font.woff); }
@font-face { font-family: 'Circular Std White'; src: url(my_white_font.woff); }
@font-face { font-family: Circular Std Black; src: url(my_black_font.woff); }
@font-face { font-family: Circular Std White; src: url(my_white_font.woff); }
@font-face { font-family: Black; src: url(my_black_font.woff); }
@font-face { font-family: White; src: url(my_white_font.woff); }
Becomes:
@font-face{font-family:"Circular Std Black";src:url(my_black_font.woff)}
@font-face{font-family:'Circular Std White';src:url(my_white_font.woff)}
@font-face{font-family:Circular Std #000;src:url(my_black_font.woff)}
@font-face{font-family:Circular Std #fff;src:url(my_white_font.woff)}
@font-face{font-family:#000;src:url(my_black_font.woff)}
@font-face{font-family:#fff;src:url(my_white_font.woff)}
So for fonts without quotes, this is a problem. I am aware fonts should have quotes, but when minifying wordpress plugins you don't always have control over what the other developers do.
I'll try to change the regex of shortenColorCodesToHex and send a PR for this. It's possible that this issue occurs in other css properties as well, so I guess it's better to restrict the changes to the color and background properties.