Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Font loaded twice when using GOV.UK Frontend with GOV.UK Elements #1001

Closed
NickColley opened this issue Sep 17, 2018 · 3 comments
Closed

Font loaded twice when using GOV.UK Frontend with GOV.UK Elements #1001

NickColley opened this issue Sep 17, 2018 · 3 comments
Assignees
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation)

Comments

@NickColley
Copy link
Contributor

NickColley commented Sep 17, 2018

@injms from the Registers team has noticed that when loading GOV.UK Frontend alongside GOV.UK Elements it will load the webfont twice.

This was surprising to me as I expected font-face to ignore a previous declaration.

They found a work around which is to trick GOV.UK Frontend into thinking it's using a custom font which'll prevent the font-face declaration to be output: https://github.com/openregister/registers-frontend/blob/e387d872828fbc5239a4c872fd759911794b021b/app/assets/stylesheets/application.scss#L39

We should keep this in mind when implementing the new version of the font.

@NickColley NickColley added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) user-request labels Sep 17, 2018
@NickColley
Copy link
Contributor Author

I've seen this happen on GOV.UK too, so I think this is important for us to fix soon.

image

@NickColley
Copy link
Contributor Author

I've noticed on faster connections the fonts will race each other, so if the original definition returns first it wont try and download the second declared version of the font.

This means on slower connections they will always download.

@NickColley
Copy link
Contributor Author

We could see if the user has turned on the template compatibility mode, if they have, don't load the font declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation)
Projects
Development

No branches or pull requests

3 participants