3 ms·
Is there an easy way of doing HTML templating with Go/Rust, as you would in PHP?
by zozbot234 5y ago
Is there an easy way of doing HTML templating with Go/Rust, as you would in PHP?
- bovermyer 5y agoNot as easily as in PHP, but yes. https://pkg.go.dev/html/template https://pkg.go.dev/html/template (for Go)
- radlad 5y agoIMO the template package in Go is kind of awful. The contextual escaping is very cool (although a little frightening given the complexity of it), but the ergonomics of parsing, nesting, and executing templates is very confusing IMO.
- 0des 5y ago> the ergonomics of parsing, nesting, and executing templates is very confusing IMO Can you elaborate on this?
- smt88 5y agoRust has lots of template libraries. HTML templating is a solved problem that PHP doesn't uniquely do well anymore.
- steve_adams_86 5y agoI guess that depends on what you mean by “as you would in PHP”. I assume everyone uses something like Twig these days, so in that case, absolutely. You even get compile time checking from Rust libraries like askama: https://github.com/djc/askama https://github.com/djc/askama
- deleted 5y ago[deleted]