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

curious, would this work in a server side rendering context? #38

Open
mreinstein opened this issue Sep 13, 2022 · 2 comments
Open

curious, would this work in a server side rendering context? #38

mreinstein opened this issue Sep 13, 2022 · 2 comments

Comments

@mreinstein
Copy link

or is this only compatible with a pure client side implementation?

@schlosser
Copy link
Owner

The issue here is that we don't know the screen size on the server, so we can't easily compute the size of the images. So probably not, unless you want to calculate a "guess" based on some hacky info like the user agent.

@mreinstein
Copy link
Author

calculate a "guess" based on some hacky info like the user agent.

It's too bad that the Accept-CH: Viewport-Width client hint never caught on. It would have been useful for exactly this kind of scenario I think.

we don't know the screen size on the server

I'm wondering if on the server side one could set some "reasonable" initial state that assumes mobile width (e.g., 400px) and then while the page is loading, re-calculate actual viewport width. that might be ok because the server side render really just needs all the DOM elements to be generated, which gives us all the nice SEO benefits.

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