Pug

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, ...

Get Mastering JavaScript Single Page Application Development 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.