Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replacing 'white' and 'black' to '#fff' and '#000' breaks fonts #316

Open
peixotorms opened this issue Mar 11, 2020 · 1 comment · May be fixed by #327
Open

Replacing 'white' and 'black' to '#fff' and '#000' breaks fonts #316

peixotorms opened this issue Mar 11, 2020 · 1 comment · May be fixed by #327

Comments

@peixotorms
Copy link

peixotorms commented Mar 11, 2020

Hi,

I don't see the point of #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.

@peixotorms peixotorms changed the title Replace 'white' and 'black' to '#fff' and '#000' breaks fonts Replacing 'white' and 'black' to '#fff' and '#000' breaks fonts Mar 11, 2020
@enricodias
Copy link
Contributor

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants