Hacker News new | past | comments | ask | show | jobs | submit login

Pug templates(https://pugjs.org/api/getting-started.html) are fairly nice.

The main dlang web framework, vibe.d, uses a 1:1 copy called "diet" templates (You can insert D code to be run on the server, with the arguments given to the HTTP request/response). This works very well IMO, mainly because D is a very good programming language, so you can mix very fast / expressive D code with your regular JS for client side work.




Oh god, no. I don't know if I'm missing something but pug has been single handedly the worst templating engine I've ever seen. Why would you want to write some cryptic template that somehow gets turned into HTML?


For me, forcing me to be good about whitespace is very nice, no closing tags is even better, but the real kicker is

    .sep
vs

    <div class="sep"></div>
So short and concise! And the "somehow" isn't that magical... The code you right else where ultimately gets transformed into something else, too!


Typed that mobile and wish I could edit it... Sorry!


Similarly Nim templates (they are called filters in Nim) are very good. It's just Nim code with markup code interspersed, it works very well but I do admit that it could still be improved.

What I like most about it is that i can just use Nim code in my templates. I can't say the same for Django templates or (I guess) Jinja.

https://nim-lang.org/docs/filters.html


I'm a huge fan of Pug. Out of the various view engines I've used, it's been the most intuitive and productive for me. Pug, with it's indentation defined blocks, seems like a good fit for Python (less context-switching), though I've mainly used it with Node.js.

One peeve: managing multiple partials for a single page with mixins seems a little more complicated than necessary.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: