• nykula@piefed.social
    link
    fedilink
    English
    arrow-up
    15
    ·
    2 days ago

    JavaScript has been my favorite language for a decade. Still, I try to make websites server-rendered so that they can be read if my code fails to load or execute. For example, there are power outages in Ukrainian cities for most of the day because of the war. When there’s no power, there’s still 4G for a while but it switches to economic mode and slows down to a crawl. The websites of the monopolist energy company require a lot of JavaScript. It often fails to load for me during the outage. It’s also not keyboard-accessible because of how its JS is implemented (I won’t image I’d do better, they have a team while I’m a solo programmer, but I try and they don’t). For me to see when there will be electricity at what place and plan where to go study and work, I have to rent a VPS, scrape their website and show me a static table that doesn’t require JS to load. Some code to see what I mean: https://codeberg.org/nykula/powerup

    • dan@upvote.au
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      JavaScript has been my favorite language for a decade. Still, I try to make websites server-rendered so that they can be read if my code fails to load or execute

      Have you tried Astro? It’s good for exactly this. You write Astro components that look a little bit like React components, but they’re all rendered either during the build (when using static site generation) or server-side.

      You get the developer experience of a modern JS framework, with the output of a static site with minimal JS.

      • nykula@piefed.social
        link
        fedilink
        English
        arrow-up
        5
        ·
        1 day ago

        Yes, I tried multiple popular SSR frameworks and use one at work. As a hobby, I’ve been making my own SSR framework that is much more minimal, based on Preact, Valibot, Vite, node:sqlite, URLPattern, gettext.js and a few companion libraries. (But components look more like old-school Mithril than React because no JSX extension, just standard JS.) I want its node_modules to stay below 200 MB and to pick such dependencies that the apps built with it can be included in Debian repositories and potentially FreedomBox. Hopefully I’ll be ready to make a fedi post about it next month.