DEV Community

Discussion on: Pug vs EJS?

Collapse
 
matthewbdaly profile image
Matthew Daly • Edited

I'm not fond of either. I haven't used Pug since it was Jade so my experience of it may not be up date date, but I always found it too terse for my liking and too different to HTML. I haven't used EJS at all, but it looks a lot like Underscore templating which I always found cumbersome.

I agree with Meghan that Handlebars is also worth a look. I've used Handlebars a lot (my site is built with a static site generator I wrote that uses Handlebars), and it has a very shallow learning curve.

Alternatively, have you looked at React.js? It's my usual go-to for JS templating these days and can be used to render the same template on client and server side. It's more complex than the others as it also includes things like event handling, so it might be overkill for you, but for some use cases it can be a boon.

Collapse
 
jkimquickdev profile image
Kim John

Thanks for the comment, Mark. I find react is a little bit overkill for the kind of project I'm doing. In other words, I need something really simple. Given the site is static, my goal to reuse the pieces of HTML code, that's it.

Collapse
 
matthewbdaly profile image
Matthew Daly

In that case, Handlebars should be a good fit. It supports partials, and you can create your own helpers. The syntax is IMHO simpler than EJS or Pug too.