News for hackers. Stuff that matters.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by mjgoeke on Thursday January 07, 2021 @08:06PM (#25680034)
I really like this project, especially when going through the docs. Nearly all the abstractions are very clean in their approach, the only outlier being the hack of using `#each` `/each` comments to indicate looping. I suppose the HTML specs don't have anything for this yet, so one has to adapt in some way.

I like the docs because, having come from a different dev environment, and seeing web/html as a vast sprawling landscape of surface area to learn, littered with defunt, old, broken, and janky throwaway bits everywhere - the documentation implicitly points out the core path of what's needed to understand how to bind and work with data in a web page.

Bravo!

I'm convinced this clarity comes from you distilling down what exactly _are_ the core pieces, and only implementing them first.

some rambling questions:

I wonder how this (synergyjs) works for a webapp type situation? Would one extract .js scripts as modules to reuse custom components? or is that trying to bring this into a more complex setup than is the sweet spot for this lib? e.g. is this better suited for a page at a time?

Also, maybe I'm dense, but does this approach lend itself to single page apps? My understanding is it shines when you have single pages with some logic behind them. If you need to jump to another page, the "passed data" would be encoded in the url, yes?

(I seem to recall the html 5 standards were looking to add something (was it 'proxy'?) that was something like frames, but involved web components, and maybe even passing of data through slots... is that a thing?)

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by defx on Thursday January 07, 2021 @08:32PM (#25680275)
RE: Would one extract .js scripts as modules to reuse custom components? Yes, you can certainly do that. the define function supports both template element nodes or strings, so you can work directly in a HTML document (the web will be getting HTML imports before too long) or do it all in JS and publish to NPM.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by defx on Wednesday January 13, 2021 @04:25AM (#25759911)
Hi mjgoeke, an update RE the "hack of using #each", synergy is now using <template each="item in items"> since v2 (https://synergyjs.org/repeated-blocks). Much less hacky, and has also saved a few more bytes from the overall package size.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by defx on Thursday January 07, 2021 @08:28PM (#25680237)
Thank you, much appreciated. Yes, there are proposals for native templating, but i suspect it will take some time to agree on such things. I opted for comments in the end mainly to support multiple top level nodes, but they also prove helpful for place-finding when inspecting the DOM.