Why you should use Pug instead of HTML

Source: Internet
Author: User

Pug is a set of elegant and feature-rich template engines formerly known as Jade. At present, more and more companies and developers use Pug instead of HTML as the template language. So what good is it?

1. No end tag required

In HTML, almost every label needs to write an end tag, which takes time and effort to make the code more verbose, and if forgetting to write an end tag can cause unpredictable and difficult-to-locate errors. By contrast, Pug does not have an end tag, and the code is more concise and efficient.

2. Force indent

Forced indentation Some people like people don't like it, but the benefits are undeniable: It makes the style of everyone in the team unified, so that reading other people's code is no longer so scary, so that everyone has developed a good habit of indenting code, but also reduce the code formatting caused by conflicts and other issues.

3. Code Reuse and Maintenance

The Include feature in Pug allows us to no longer write the same code over and over again, such as header references and component templates. When you encounter a change, you do not have to search and modify each place one after the other, just modify one place at a time.

4. Tag notation is the same as CSS

The tags in the pug are written in the same way as the selectors in CSS, so it is more convenient to write CSS and can directly copy the tag as a selector.

These are the four greatest benefits of using Pug. The rest is waiting for you to explore.

Why you should use Pug instead of HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.