Questions tagged [pug]

Pug (formerly known as Jade) is a robust, elegant and feature-rich template engine for Node.js.

Pug (formerly Jade) is a clean, whitespace-sensitive syntax for writing HTML. Here is a simple example:

doctype html
html(lang="en")
  head
    title= pageTitle
    - if (foo) bar(1 + 5)
  body
    h1 Pug - node template engine
    #container.col
      if youAreUsingPug
        p You are amazing
      else
        p Get on it!
      p.
        Pug is a terse and simple templating language with a
        strong focus on performance and powerful features.

Produces following output as HTML:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Pug</title>
    <script type="text/javascript">
      if (foo) bar(1 + 5)
    </script>
  </head>
  <body>
    <h1>Pug - node template engine</h1>
    <div id="container" class="col">
      <p>You are amazing</p>
      <p>Pug is a terse and simple templating language with a strong focus on performance and powerful features.</p>
    </div>
  </body>
</html>

Links

6377 questions
27
votes
6 answers

How to use google analytics from jade file

I want to track the users of my website. Since I do not have an old fashioned HTML file, should I adapt the given code to the jade syntax or can i leave the script untouched and include it somehow? In case I need to convert it to jade syntax, can…
NSMutableString
  • 10,493
  • 1
  • 21
  • 27
27
votes
1 answer

Difference between include and block in Jade

What is the the difference between blocks and using include when you are creating Jade templates? When do you use one over the other?
LuckyLuke
  • 47,771
  • 85
  • 270
  • 434
26
votes
7 answers

How do I put a html tag conditional in jade?

In jade, I want to put in a html tag conditional as per this method, which puts in