Anyone want to share their opinion on using someth...
# server
j
Anyone want to share their opinion on using something like kotlinx.html for server side rendering vs a traditional templating engine like FreeMarker or Pebble? Just looking for advice or feedback on current best practices, if there are any.
d
what are you making?
s
Its nice to have kotlin in the template instead of a gimped programming language. On the other hand the compilation speed versus other template types isnt great
Would choose kotlinx.html again
j
At the moment I'm just toying around. I'm coming from a python/flask background, so I'm used to Jinja templates but playing with kotlinx.html has been enjoyable. Before I started actually using it just wanted to make sure I wasn't committing a big no no. 😂
I doubt template compilation speed will ever be a factor for my projects but will make sure to benchmark it a bit to see if it makes a huge difference. Thanks for the feedback!
d
if what you're making anything interactive you should really look into javascript solutions (like vue.js), it will make everything a lot more manageable in the long run
a
ever since I started using kotlinx.html every templating language seems anemic
the promise of templating languages like thymeleaf is that the designer can fiddle around with it
but in practice this almost never happens so it is infinitely better imho to use a proper programming language for templating
j
I’ve tried to get our frontend devs to write our email templates in kotlin, but it seems compilation speed is a big slowdown. Anyone reached a similar conclusion?
k
everything in kotlinx.html is a function, so you can test it 🙂
🎉 1
n
It is significantly easier to do loose coupling with DSLs (it is a series of function calls), and is very tooling friendly (no extra tools/plugins required).
s
@Jeff Gulbronson Yes it can be really slow. I am not going to trade our sass for a kotlin dsl for this reason.
👍 1
b
main benefit is that XSS is impossible if used normally
because you have type safe builders compared to strings