News for hackers. Stuff that matters.
Re:What's new in Svelte (Dec 2020) by IceWreck on Thursday December 03, 2020 @08:26AM (#25288568)
> The initial pages are Go templates which are hydrated with Svelte components. It took a bit of trial and error to get the flow right so that I don't have to write double the code.

What is the advantage of doing this over using http.FileServer to serve html which imports your svelte generated javascript directly ?

Are you using Svelte in a part of your application instead of the entire application?

Re:What's new in Svelte (Dec 2020) by SubGenius on Thursday December 03, 2020 @08:46AM (#25288755)
I wanted the initial render to be fast, and Go templates really shine there. Since the site has a lot of moving parts, there are many components that get hydrated depending on the page. For instance, this page (https://gurlic.com) is generated by Go, but the actions such as like/dislike/share/respond are hydrated by their respective Svelte components. If you scroll all the way down, new posts are fetched and rendered with Svelte components too, and the great bit is that I can use the same action (like/dislike/etc) components there.

Maybe there's a better way to do it, but I like writing smaller components that can replace initial server-rendered HTML, and can then be imported into larger components.

Re:What's new in Svelte (Dec 2020) by throwaway894345 on Thursday December 03, 2020 @11:08AM (#25290280)
That's a really neat site. Is it open source (can I peruse the source code)?
Re:What's new in Svelte (Dec 2020) by SubGenius on Thursday December 03, 2020 @11:26AM (#25290532)
Not yet, but it's on the roadmap. As soon as I've had time for better integration with Matrix, a bit of refactoring, and writing more tests!
Re:What's new in Svelte (Dec 2020) by edoceo on Thursday December 03, 2020 @09:23AM (#25289060)
I like this way too