© Jörg Krause 2017

Jörg Krause, Programming Web Applications with Node, Express and Pug , 10.1007/978-1-4842-2511-0_6

6. Introduction to Pug

Jörg Krause

(1)Berlin, Germany

Pug is a template engine for Express, the middleware and routing solution for Node.js. It is the standard for Express. If you argue intensively with Node.js and Express, no way leads past Pug.

Overview

Pug uses a simplified representation of the HTML site by simple text instructions. These correspond in a practical way to the names of the HTML tags. Since HTML develops a hierarchy and Pug knows no closing tag, the tree structure must develop differently. In addition, Pug uses identations in the text editor. 2 blanks show that the following element is a child element.

Editor ...

Get Programming Web Applications with Node, Express and Pug now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.