Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 23, 2022 08:03 am GMT

What is Pug HTML for beginners | All-time-dev?

What is Pug HTML for beginners | All-time-dev?

Pug HTML

Today, we are going to know about PUG which is a very important topic for you if you are a backend developer we will know the history of PUG, what is a pug and its uses what are template engines, and more. So, if you are interested and if you like our today's post then share it with your developer friends. So, that they can also gain some knowledge about PUG.

What is PUG?

Pug is a template engine for NODE JS means that if you write any PUG code then it will compile into HTML and its syntax will become simple which will help you understand your code better and eventually, it will increase productivity while coding and it also helps in writing reusable HTML code and it also helps in pulling data from a database while using an API from Rapid Apis or any other site but if you don't know what is a template Engine then it enables you to use Static template files on your web app. At Runtime means Node JS which is a JS(JavaScript) runtime. In this case, Pug which is a template engine will replace the variables in the file with actual values and will transform the file into an HTML file which helps you to design an HTML page and will also help you make it dynamic easily if you are using NODE JS and Mongo DB. So, simple Pug is a template engine for NODE JS which helps you to write HTML in the backend for a better understanding of code and easy reusability, and if you are thinking that if I am writing Node JS then can we only use PUG with Node JS then no we can also use with PHP, Python and several other languages and different languages have there different template engines like Python have its own template engine named Mako and JavaScript also has its own template engine named Jade/Pug, ejs (Embedd JavaScript)and some template engines also supports more than one language like Mustache which supports Ruby, JavaScript, Python, Erlang, Objective-C, Go, Lua, Scala, Node JS, Python, Java, .Net, Android, C++, C, C# and more and there is a important fact about Pug is that its old name was Jade which was changed into pug due to a trademark.

Top 5 tools which are integrable with Pug

Pug is very awesome and it has some integrable with some tools that you can use to increase your productivity and to use it for more uses like creating backend, for generating HTML websites, charting and more.

  1. Lad which is a Node JS framework
  2. Node JS which is JavaScript Runtime
  3. Prepros which is a compiler
  4. Squido which is a HTML website generator
  5. Anychart for charting

Popular companies using Pug

As Pug is very popular for serving dynamic content with Node JS then there are a lot of companies who is using Pug for growing their business like -

  1. Glovo
  2. Coursera
  3. 1mg
  4. Chiper
  5. Shimo website
  6. Barogo
  7. Accenture

Top 10 template engines rather than Pug
Pug is a very popular JavaScript template engine but there some more template engines which are even more better than Pug. Now, I will tell only the names of those template engines but if you want a complete post on that topic then you can comment below. I will definitely create a post on that topic.

  1. Mustache.
  2. Underscore Templates
  3. Embedded JS Templates
  4. HandlebarsJS.
  5. NunJucks
  6. UnderScore JS
  7. Webix
  8. Hogan.JS
  9. Swig
  10. Marko

So, these are some of the popular template engines rather than Pug HTML that you can use as an alternative all of them are very good.

Is using Pug better than using HTML and React?

Many people have doughts that why should we use Pug instead of just using HTML which every web developer already knows instead of learning template engines which is new for us then the simple answer is that Pug is more powerful and provides features like conditions, loops, included, mixins like SASS that we can render on reference data or whenever when the users inputs data and it natively supports JavaScript as it is both a JavaScript library and also a JavaScript template engine and an important reference that I have given you in the introduction is that, Pug is important to make website dynamic then yes its very important as if you want to make a website dynamic then at that time you must need Pug to serve dynamic content with NODE JS. So, in this case using Pug with Node JS will be better idea then using HTML with it. but if we choose to use Pug instead of React that's not a good idea as React JS is not only a template engine like Pug JS it is also framework that you can use to create web apps frontend and everyone knows that if you want to create a web app then the best stack is MERN STACK which includes React with Node JS, Express JSand Mongo DB. So, in this case if you want to create a web app then I would recommend using React JS.

To continue reading the post visit https://all-time-devlopment.blogspot.com/2022/01/what-is-pug-html-for-beginners-all-time.html


Original Link: https://dev.to/alltimedev/what-is-pug-html-for-beginners-all-time-dev-5d38

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To