I’m looking for an HTML template engine, ideally one that implements a widely-used syntax like Liquid or Mustache or Golang Templates so I can easily use/adapt existing themes for Hugo/Jekyll/etc.
The most commonly used one seems to be Karax, but it mixes templates with code, and I prefer to keep them separate. There’s also a simple template engine that comes with Nim, that has the same issue.
The Nimble directory has onionhammer/nim-templates, which is pretty basic and undocumented, and idlewan/jade-nim, which hasn’t been updated in six years.
Anyone know of something else?
@snej
I was looking for the same thing, especially something like Pug.js or Slim (a Ruby thing).
Please let me know how Moustachu works for you, if you give it a try.
I opted for the stdlib’s htmlgen module which looks quite nice, though I do have a thread asking about some ways to improve the syntax.
https://forum.nim-lang.org/t/6656
My current plan is to have .nim files that contain just views or layouts being built as strings and accepting parameters for the data and for plugging in other views / elements.
That way I will have some semblance of separating logic from layout.