Remix.run Logo
▲ Humphrey 4 hours ago

I love the idea! I could imagine something similar created for other languages too. Perhaps written in a way that a template could be reused in, let's say Django, and a JS React frontend. With all the type-safety that tsx provides.

▲lucasdicioccio an hour ago | parent | next [-]

I recently built some templating language (rather an intermediary language for documents) for solving an accumulated frustration over the years. Already added into four or five of my projects (for templating html, emails, dashboards, chatbots messages, and some configs).

The design point "deterministic, hostable, with enough to make hooks from the templates" is what makes it special: https://lucasdicioccio.github.io/tramaj/ .

▲marcle 4 hours ago | parent | prev | next [-]

I always thought that the type-safe XML/HTML in Ur/Web was elegant.

For examples, see http://www.impredicative.com/ur/demo/

▲riffraff 3 hours ago | parent | prev | next [-]

There was a brief period where everyone and their dog implemented mustache[0] as a template system, but it died quickly because cross-language templating is not that useful in the end, you seldom need to switch host language but keep the templates.

0: https://en.wikipedia.org/wiki/Mustache_(template_system)

▲bvrmn an hour ago | parent [-]

I think the craze was about "purity" of mustache as presentation-only template engine. Apparently you need some level of logic to be useful.

▲sorokod 4 hours ago | parent | prev | next [-]

Type safe DSLs in Kotlin

https://kotlinlang.org/docs/type-safe-builders.html

▲brabel 2 hours ago | parent [-]

Copied from Groovy Builders, here's an example from 2009: https://blog.mrhaki.com/2009/10/groovy-goodness-creating-xml...

▲dnautics 4 hours ago | parent | prev | next [-]

This is sort of halfway between tsx and Elixir's EEx

▲boxed 3 hours ago | parent | prev [-]

I think nim also has this.

As for Django... well.. Django only has text formatting, you can write any garbage and broken html and lots of invalid templates with silent failures there unfortunately.

▲insin 33 minutes ago | parent [-]

This had me checking if anyone has implemented first-class support for Python JSX components in Django yet, and it could be... sort of... maybe viable with PyJSX? [1]

It looks like you'd have to implement something equivalent to provider/context functionality yourself if you want it, as well as a simple render()-like helper to render a component tree. I've not tried their VS Code plugin, but it's a good sign that they have one.

[1] https://github.com/tomasr8/pyjsx