Pug, formally named Jade, is a JavaScript templating engine that is prominent in the Node.js community. It is largely influenced by HTML abstraction markup language (Haml), which was originally designed to make authoring ERB templates easier by using a cleaner and less verbose syntax than raw HTML. In this way, Pug requires the compilation of not only its expressions, but of the markup language itself.
Pug is similar to YAML in that hierarchy is denoted by whitespace with indentation for delimiters. This means that no closing element tags are necessary:
doctype html html(lang="en") head title= pageTitle body h1 This is a heading if thisVariableIsTrue p This paragraph will show. else p This paragraph will show instead.
As shown in this example, Pug can be used as a simple shorthand syntax for HTML. It can also include simple conditionals with variables, all following the same fluid syntax. HTML element...