This is Quick POC of an idea i had: what if you could edit Svelte components in place in the browser — using the File System Access API!
What if we didn't have to mentally map our source code rendered content? Just click on component, source pops up, we edit, save. No IDE needed!
note: this idea works only in development - which makes sense if you think about it
https://user-images.githubusercontent.com/6764957/120790682-d9b7c400-c565-11eb-9580-740279005543.mp4
npm install
npm run dev -- --open # localhost
load
button to open src/components/Comp.svelte
- you will have to navigate there yourself until this PR landssave
buttonYou now have a self-editing component!
<pre contenteditable>
which is janky afits still too clunky - you HAVE to use showOpenFilePicker
right now to load a file.
Ideally we can just give a known filepath and construct the FileSystemFileHandle
ourselves, but this is currently impossible. i've opened an issue here.
if it were, we could then instrument svelte's rollup/webpack loader to expose filepath info to every component so that we can figure out which component to open (or offer a menu of them) instead of having the user navigate to there.