News for hackers. Stuff that matters.
Re:Ask HN: What novel tools are you using to write web sites... by brundolf on Monday April 05, 2021 @12:25AM (#26695350)
Not sure if this counts, but for simple stuff (both front and back-end!) I've been loving regular JS template strings for rendering HTML. Your render logic ends up looking very similar to React functional components, and you can get editor extensions that do syntax highlighting inside the string.

There are obvious downsides - on the back-end it's slower than a proper templating system, and on the front-end you're rebuilding the DOM tree from scratch each time, with all the limitations that includes (performance, animations get interrupted, HTML state gets lost, any event listeners have to be re-initialized). But for simple stuff, I cannot recommend it enough.

Here's a back-end example from my personal website: https://github.com/brundonsmith/website/blob/master/src/rend...

And here's a front-end example: https://github.com/brundonsmith/blogs/blob/master/docs/site....

Re:Ask HN: What novel tools are you using to write web sites... by atis on Monday April 05, 2021 @06:39AM (#26697321)
You may be interested in doing js template strings with preact/react - no build tools required! Btw there's vscode support for this so you get syntax hilight too

https://github.com/developit/htm

Re:Ask HN: What novel tools are you using to write web sites... by brundolf on Monday April 05, 2021 @12:52PM (#26701425)
Avoiding transpilation is nice, but so is avoiding a library altogether. I take this approach when I just want to get going with zero setup and zero overhead; if I'm going to the trouble to set up React then I'll want bundling, and at that point I'll probably just go ahead and configure JSX and TypeScript.