Impossible Day Project: Edit from Live to Local

Logbook

Thu Jan 18 08:46:33 PST 2024

About 5 minutes before I spoke up at the Impossible Day Kickoff at RC, I realized I'd been kicking around this idea in my head for a while. I had discounted it and forgotten about it because I couldn't imagine how to do it. Well, that's what this day was all about.

To start, I drew a diagram of the concept.

With that, I felt like I could put the idea into some words.

The goal: Enable live editing on my website (https://reeds.website, not just localhost). I can edit in the browser and those edits show up on my local disk.

There are two confounding factors:

  1. How does my live website send messages to my local computer to edit my file system securely?
  2. How do edits to my page map back to their source code? There is a convoluted process by which source becomes the output HTML. The source is often MDX or JSX, which is often shaped differently from the resultant HTML.

Question #1 seemed less impossible to me, but an exciting project for another time. Jeff provided some thoughts for a server which poked some holes in my simple idea. The problem still felt possible, but more complex.

Question #2 felt absolutely impossible. I had used source code maps generated by tools like Babel. That felt complicated enough. If I had a source map, it might feel possible to connect that to the output and map edits in the other direction, from output to source. But I couldn't imagine any such tools would work for my website.

I recently had rebuilt my website generator from a bunch of disparate parts which I barely felt like I understood.

P.B. shared that MDX has a source code generating option. Apparently that relied on a mozilla library. We tried it out together on a call to see what it generated. We got what looked like a map!