jungvonmatt / wekit

A Jamstack kit for Contentful, Hugo and Netlify.
https://www.wekit.dev
MIT License
14 stars 4 forks source link

Add media attribute to preload tags #30

Closed bezoerb closed 2 years ago

bezoerb commented 2 years ago

Currently, when different ratios are shipped in the stage media (e.g. desktop: 16:9, mobile 4:3), we add two preload tags to the document head. One for the desktop image & one for the mobile image.

image

We need to provide appropriate media queries here to prevent preloading images which are not being used on the current device. See: https://web.dev/preload-responsive-images/#preload-and-lesspicturegreater