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 What is Pug?

Kevin Gates
Kevin Gates
15,053 Points

Is it worth it to learn Pug (a JS templating language) in light of various frameworks?

This is a subjective question for sure, but in light of Vue, React, Angular, etc, is learning Pug (or other templating languages) something even worth doing?

I know Vue uses the mustache syntax {{variable}}. I presume React and Angular do something similar.

For anyone who has been doing this for a while, what are your thoughts?

I'll probably learn it for the sake of the course, but not sure if I should continue learning this in my own time or not.

Thanks for everyone's input!

2 Answers

Hi Kevin

Pug is still a viable option yes and is also good to get hands-on with the use of data.

I wouldn't say its comparable with the others that you mentioned though as it is dependant on your project your working on.

For example: I use pug within my team with hexo for a static site that populates an internal styleguide for a front end framework, we use pug because it is very easy to use and doesn't require much knowledge outside of native javascript.

However, I also use Angular within my team for certain web apps as the tooling for angular fits the project better.

So depending on your goals, project requirements and your interests would depend if I recommend you use it or not.

My opinion would be to learn it but don't spend too much time on it, as mentioned above, pug closely resembles native javascript in many ways so once you have a basic understanding, start learning more complex frameworks like Angular, React, etc

Good Luck

Kevin Gates
Kevin Gates
15,053 Points

Thank you for your input. Very helpful. I appreciate the examples also.

At the time of this post (Jun 15, 2020) handlebars.js is the most popular according to npmtrends.com

https://www.npmtrends.com/pug-vs-handlebars-vs-ejs-vs-mustache-vs-nunjucks-vs-etc-vs-hogan.js-vs-dust-vs-swig

Tyler McDonald
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tyler McDonald
Full Stack JavaScript Techdegree Graduate 16,700 Points

jlampstack, that's a great point. I didn't even realize how much the information presented has changed. I just compared pug with handlebars on npm website, and according to just the weekly downloads, handlebars is downloaded 8 times more often than pug!