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

Ensure font is not loaded twice on slow networks #1242

Merged

Commits on Mar 18, 2019

  1. Configuration menu
    Copy the full SHA
    2da5d0e View commit details
    Browse the repository at this point in the history
  2. Ensure font is not loaded twice on slow networks

    Prior to this change if you were loading GOV.UK Frontend alongisde
    alphagov/govuk_template you would have two @font-face declarations that
    tell the browser how to load the 'nta' font.
    
    This is normally not an issue since as soon as the browser downloads a
    version it won't download a second copy of the font.
    
    However when a user is on a slow connection, the browser can try to
    download the font from the alphagov/govuk_template declaration and
    GOV.UK Frontend declaration.
    Which means that the end user will download the font twice (and it's variants)
    resulting in a much slower experience.
    
    This is even more of a problem for users on a slow network since their
    bandwidth may already be constrained.
    
    To avoid this we check if the user has indicated they are using
    GOV.UK Template by checking the relevant compatibility flag.
    
    If they have set this flag, we avoid outputting the declarations with the
    assumption that they will already have them, avoiding the chance of the font being downloaded twice.
    
    This feature can also be disabled with a top level $govuk-include-default-font-face flag to ensure that our users have full control.
    NickColley committed Mar 18, 2019
    Configuration menu
    Copy the full SHA
    f5c206e View commit details
    Browse the repository at this point in the history
  3. Add CHANGELOG entry

    NickColley committed Mar 18, 2019
    Configuration menu
    Copy the full SHA
    632f98c View commit details
    Browse the repository at this point in the history