A clean, whitespace-sensitive template language for writing HTML
Full documentation is at pug-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.
For full API, see pug-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: