It was a great experience, at least to the extent I needed it. What sold me on it is its support for template composition[1], something I've struggled with using the standard `html/template`. And I really like the idea of generating statically typed templates which are just Go functions in the end of the day. In theory, I can share them between many of my apps, especially as I'm using a monorepo for all my projects. This is yet to be tested though.
There are some rough edges around using `script` templates[2], for example it doesn't allow you to pass `this` and `arguments` from HTML event handlers[3]. This is not a show-stopper though, because you can always fall back to just defining your event handler in an HTML <script></script> block, albeit without type checking of the arguments and deduping the scripts. Also it hurts Locality of Behaviour which I'm a fan of.
That being said, I think it has some great potential. I can completely imagine people building fully-fledged UI libraries in this once component reusability is improved.
But the best part of using templ for me was that I could completely get rid of Node and NPM from my stack.
I’ve been using pongo2 for a year or two as I always found the standard html/template to be annoying to work with for inheritance as you mentioned. I’ve got years of Django experience and always liked their templates, and pongo2 is basically just Django templates in Go so it’s nice.
But being able to break things into reusable components with templ is compelling (and works fairly well from my experimenting). I’m just not in love with how you pass data into it and I ran into a few awkward points with the string interpolation of data when doing inline scripts.
I’m sure if I spent more time with it, I’d overcome these issues quick.
I remember checking out pongo2 briefly before deciding on templ, but my lack of familiarity with its syntax kept me away. I guess the calculus is much different if you have prior experience, but for me it was attractive that templ uses Go syntax in its templates (with some exceptions).
Yeah, passing data if for some reason you can't use templ's `script` block can be annoying, if that's what you meant! I think they should make sure that the `script` block works in every situation and then it's going to be way less awkward.