Elementary: A modern and efficient HTML rendering library - inspired by SwiftUI, built for the web

I think that's the correct approach to be honest. Focus on the specific problem and solve it really well. static site generators can decide to integrate it on their side.

I have to say I'm impressed, because thanks to the library being so focused it's exactly what I needed. You have all the fancy syntax, html elements, etc, but at the end of the day it's all to output String. And that's what I needed!

My site generator was build on the idea of keeping things very simple, so so far I've been just using multine string literals with interpolation. Yes, this may make some people cry inside, but honestly, it works for what I needed and makes it trivial to use premade html templates with nice CSS. But for some pages I wanted to make things a bit nicer with Swift so I was looking into a library with a nice DSL.

Literally a couple of minutes has taken me to use yours.

The fact that has 0 dependencies, doesn't depend on any html/css framework, and that just outputs String has made it trivial to incorporate. With the added benefit that it interoperates flawlessly with the entire existing codebase (see how the HTML is my existing html generating function, and the div stuff is your library). It's awesome!

I'm sure in the next few days I will add a few additions to my generator to make it nicer (easy to just extend the Page type to accept also your HTMLElement and call the render behind the scenes) but so far it already does what I need.

This speaks to how nicer simple libraries are. Well done :+1:

2 Likes