LinuxCommandLibrary

pug

TLDR

Compile Pug to HTML

$ pug [file.pug]
copy
Compile to specific output
$ pug [file.pug] -o [output/]
copy
Watch for changes
$ pug -w [file.pug]
copy
Pretty output
$ pug -P [file.pug]
copy
Compile directory
$ pug [src/] -o [dist/]
copy

SYNOPSIS

pug [options] files...

DESCRIPTION

Pug (formerly Jade) is a template engine for Node.js. It compiles to HTML with a clean, whitespace-sensitive syntax that eliminates closing tags.

PARAMETERS

-o, --out dir

Output directory.
-P, --pretty
Pretty print output.
-w, --watch
Watch for changes.
-c, --client
Compile for client-side.
-O, --obj json
Locals object.
--name name
Template function name.

EXAMPLES

$ # Compile file
pug index.pug

# Pretty output
pug -P template.pug

# Watch directory
pug -w -P views/ -o public/

# With data
pug -O '{"title":"Hello"}' page.pug

# Client-side template
pug -c template.pug
copy

PUG SYNTAX

$ doctype html
html
  head
    title= pageTitle
  body
    h1 Hello World
    p.intro Welcome
    ul
      each item in items
        li= item
copy

CAVEATS

Requires Node.js. Whitespace-sensitive (use consistent indentation). Was renamed from Jade due to trademark.

HISTORY

Pug was created by TJ Holowaychuk as Jade in 2010, renamed to Pug in 2016 due to trademark issues.

SEE ALSO

ejs(1), handlebars(1), node(1)

Copied to clipboard