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

Add prop to output preload tag #805

Open
nathanaelphilip opened this issue Jul 30, 2021 · 9 comments
Open

Add prop to output preload tag #805

nathanaelphilip opened this issue Jul 30, 2021 · 9 comments
Assignees

Comments

@nathanaelphilip
Copy link

It’d be nice to have a prop that outputs these preload links automatically as outlined here: https://web.dev/optimize-lcp/?utm_source=lighthouse&utm_medium=unknown#preload-important-resources

<link
  rel="preload"
  as="image"
  href="wolf.jpg"
  imagesrcset="wolf_400px.jpg 400w, wolf_800px.jpg 800w, wolf_1600px.jpg 1600w"
  imagesizes="50vw"
/>
@nathanaelphilip
Copy link
Author

It may be easier to hook into this: https://www.npmjs.com/package/lazysizes

@frederickfogerty
Copy link
Contributor

frederickfogerty commented Aug 2, 2021

Hey @nathanaelphilip, actually I think this could be a great idea! I'll bring it up with the team and see if we can add this to the roadmap 👍 For now, you could potentially use the buildURL advanced API to generate this yourself

@jamiechong
Copy link

@frederickfogerty was there any discussion with your team to add this feature? It'd be super helpful for us. We've looked into trying to use buildUrl, but it hasn't really helped.

@frederickfogerty
Copy link
Contributor

Hey @jamiechong, I am no longer an engineer at @imgix, please contact either @sherwinski or @luqven instead

@jamiechong
Copy link

@sherwinski or @luqven care to reopen this ticket?

@sherwinski
Copy link
Contributor

Hey @jamiechong, I'm happy to re-open this and discuss with the team what a solution could look like. I can't guarantee a timeline right now but it is noted in our backlog for further investigation.

@sherwinski sherwinski reopened this Jun 17, 2022
@luqven
Copy link
Contributor

luqven commented Feb 2, 2023

Hey @nathanaelphilip,

I wanted to quickly pick this issue back up.

I think this could lead to some great DX for folks who really care about loading background images as eagerly as possible. I'd love to chat more about how this could work and what it should look like.

Did you have a strong preference for how this should get implemented? I was thinking we just add the <link> tag as a child of the <Background> component with rel="preload".

@luqven luqven self-assigned this Feb 2, 2023
@nathanaelphilip
Copy link
Author

hi @luqven ; it’s been a while but I think you would just need to add a preload prop to the component. And then you could either pass the priority level to it preload="high" or have a separate prop for it: priority="high";

@tleunen
Copy link

tleunen commented May 24, 2023

Wouldn't this work only if the app is server side rendered though? Because otherwise, it would start loading it when the real image gets rendered. There won't be any benefits I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants