Remix.run Logo
Dwedit 3 days ago

The trend to CDNs serving static content means that Javascript becomes far more important than before, so "no-javascript" sites are at a huge disadvantage.

For instance, you can load up the same static page for everybody, then after it's loaded, serve some small personalized Javascript that refers to your particular user account which then customizes the page.

thro1 3 days ago | parent | next [-]

I'm sorry to hear that. Other level no JS solution for this - without "after" - but with caching, using XSL:

https://news.ycombinator.com/item?id=41104845

Currently it looks like at least Firefox and Chromium both cache stylesheets and included files as you'd expect. In fact, you can use this to increase cacheability in general. e.g. when this site is having performance issues, it often works logged out/when serving static versions of pages. It's easy to make every page static by including a `/myuser.xml` document in the xsl template and using that to get the current logged in user/preferences to put on the page. This can then be private cached and the pages themselves can be public cached. You can likewise include an `/item-details.xml?id=xxxx` that could provide data for the page to add the logged in user's comment scores, votes, etc. If the included document fails to fetch, it falls back to being empty, and you get the static page (you could detect this and show a message).

motorest 2 days ago | parent | prev | next [-]

> The trend to CDNs serving static content means that Javascript becomes far more important than before, so "no-javascript" sites are at a huge disadvantage.

I don't follow. How does serving static content imply a requirement for JavaScript?

If anything, serving static content through a CDN means the exact opposite: just have the site point to the resource and let the CDN how the resources are handed over to clients.

YannickR 3 days ago | parent | prev | next [-]

I realized this during my exercise: I had to completely disable pre-rendering in SvelteKit for the account system to work without JS, since I want to show the username for logged in users.

RestartKernel 3 days ago | parent | prev [-]

Maybe you can hydrate the HTML with a server side function in the same network as your CDN? Though I suppose that limits how close to the edge you can serve your cache.