Sass, Pug, Haml, Slim, Stylus, and their friends all aim to make writing various bits of your frontend easier. And they mostly deliver on this primary promise. But they are all victims to the vagaries of open software development, and seem to have mostly fallen by the wayside. I loved using these through my career, so its with a bit of sadness that I realized I don't want to use them for new projects.
Nim does a lot of things very well, I love writing JSON and parsing JSON in Nim, probably the best experience I’ve had with JSON, followed shortly by just implementing it as a protocol in Elixir.
Karax’s pattern of just using language constructs to assemble HTML isn’t really novel, as nice as it is; Ruby has had one for ages in Builder (and several offshoots), Elixir has Temple, and there are probably some in other languages. They’re sort of one level of abstraction less than slim/haml, but its quite pleasant writing them. But they suffer some of the same issues Slim/Haml suffer, but also can suffer when trying to use them with component frameworks, or anything that exposes custom tags. This can, of course, be solved via metaprogramming or language-level templates, but it is a concern
The Temple examples look very nice; the Builder ones to my eye look quite cluttered in comparison, which I’m guessing is due to differences in syntax between their respective languages.
I tink the main downside of templating in general is that it ends up making interfacing with JavaScript and plain HTML harder, compared to CustomElementRegistry based components.
Builder is mostly targeted at building XML files, and so compared to XML its fairly terse. HTML is just a nice also-have. There are template langs in ruby that are a lot closer to the Elixir temple variant, but I can’t remember any of them off the top of my head haha.
A good template would make interfacing “easy”. JSX[1] is a very good example of how you can interface quite easily, and the templates used in Surface work really well to bridge some of the complexities of a server-rendered but client-dependent syntax.
I know JSX isn’t a template language, the differences don’t matter for the purpose of this discussion ↩︎
Karax has the appeal that it is just Nim code, so there is no new syntax.
Nim does a lot of things very well, I love writing JSON and parsing JSON in Nim, probably the best experience I’ve had with JSON, followed shortly by just implementing it as a protocol in Elixir.
Karax’s pattern of just using language constructs to assemble HTML isn’t really novel, as nice as it is; Ruby has had one for ages in Builder (and several offshoots), Elixir has Temple, and there are probably some in other languages. They’re sort of one level of abstraction less than slim/haml, but its quite pleasant writing them. But they suffer some of the same issues Slim/Haml suffer, but also can suffer when trying to use them with component frameworks, or anything that exposes custom tags. This can, of course, be solved via metaprogramming or language-level templates, but it is a concern
The Temple examples look very nice; the Builder ones to my eye look quite cluttered in comparison, which I’m guessing is due to differences in syntax between their respective languages.
I tink the main downside of templating in general is that it ends up making interfacing with JavaScript and plain HTML harder, compared to CustomElementRegistry based components.
Builder is mostly targeted at building XML files, and so compared to XML its fairly terse. HTML is just a nice also-have. There are template langs in ruby that are a lot closer to the Elixir temple variant, but I can’t remember any of them off the top of my head haha.
A good template would make interfacing “easy”. JSX[1] is a very good example of how you can interface quite easily, and the templates used in Surface work really well to bridge some of the complexities of a server-rendered but client-dependent syntax.
I know JSX isn’t a template language, the differences don’t matter for the purpose of this discussion ↩︎