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

Improve hero image web performance #224

Open
chrimesdev opened this issue Jan 13, 2022 · 0 comments
Open

Improve hero image web performance #224

chrimesdev opened this issue Jan 13, 2022 · 0 comments
Assignees

Comments

@chrimesdev
Copy link
Member

chrimesdev commented Jan 13, 2022

Description

The Homepage hero image uses the CSS background-image property, which is a late discovered resource, as they aren’t discovered until the render tree has been built. This means that their requests aren’t even dispatched until we’re ready to put them on screen.

Potentially use a hidden img element means the browser’s preload scanner will find this image early when loading the DOM and it will get downloaded much sooner (but will not be shown through the img element) when loaded in by the background-image property.

{% image page.hero_image width-1000 as himage %}
<img src="{{ himage.url }}" style="display: none;" alt="" />

Further reading: https://csswizardry.com/2018/06/image-inconsistencies-how-and-when-browsers-download-images/

@DomBaker DomBaker self-assigned this Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants