Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Using Templates with Express Breaking Your Project’s Templates into Partials

Why use Pug?

Just interested as to why Pug is used in this course, and not something like EJS? The Pug syntax is very different (and frustrating in terms of keeping indents and whitespace in the right place), whereas EJS has a more intuitive 'php-style' syntax.

Not that I'm complaining, as I don't really know the benefits of one or the other.

2 Answers

Robert Schaap
Robert Schaap
19,836 Points

Pug/EJS/Moustache are all pretty popular, so I suppose it's just a matter of preference.

Personally I don't mind it - the syntax is much cleaner (though being able to do .class instead of div.class I feel makes it messy again) and I don't mind being forced into minding indentation/whitespacing. The latter is pretty much forced on you in the real world anyway through a company's linting preference, though probably not in plain HTML - but again, I quite like languages that force you to write in a certain way and leave your creativity to the actual code.

Michael Pashkov
Michael Pashkov
22,024 Points

Later in this course will links to sites to convert html to pug

https://html2jade.org/

http://html2jade.aaron-powell.com/