A clean, whitespace-sensitive template language for writing HTML
Pug has been recently re-named from Jade. The website and documentation are still being updated, but if you're new to pug, you should install the pug package on npm.
Full documentation is at jade-lang.com
You can test drive Pug online here.
$ npm install pug
Pug is a clean, whitespace sensitive syntax for writing html. Here is a simple example:
PugPug - node template engineYou are amazingPug is a terse and simple templating language with a strong focus on performance and powerful features.
The official Pug tutorial is a great place to start.
For full API, see jade-lang.com/api
var pug = require'pug';// compilevar fn = pugcompile'string of pug' options;var html = fnlocals;// rendervar html = pugrender'string of pug' mergeoptions locals;// renderFilevar html = pugrenderFile'filename.pug' mergeoptions locals;
filenameUsed in exceptions, and required when using includes
falseno debug instrumentation is compiled
prettyAdd pretty-indentation whitespace to output (false by default)
To compile a template for use on the client using the command line, do:
$ pug --client --no-debug filename.pug
which will produce
filename.js containing the compiled template.
After installing the latest version of node, install with:
$ npm install pug-cli -g
and run with
$ pug --help
Implementations in other languages: