Pug

Pug

github.com

1

About this website

Pug (formerly known as Jade) is a high-performance template engine for Node.js that compiles template source files into highly optimized JavaScript functions for server-side HTML rendering. Originally created by TJ Holowaychuk in 2010 as Jade and later renamed to Pug in 2016 due to trademark issues, the library has been one of the most popular template engines in the Express.js ecosystem. Pug's syntax is designed to be concise and indented rather than verbose, eliminating the need for closing tags, angle brackets, and many boilerplate characters that make HTML verbose. Instead of writing angle brackets and closing tags, Pug uses significant whitespace (indentation) to define the nesting structure of HTML elements, resulting in cleaner and more readable template files. Key syntax features include: tag shorthand (p for paragraph, div for division, etc.), attribute syntax using parentheses (a(href=url) Click here), plain text and inline HTML, template inheritance via extends and block directives for layout composition, include directives for embedding partial templates, mixins for reusable template components, conditional rendering (if, else if, else, unless, case), iteration (each, while), variable interpolation (#{variable}), inline JavaScript code execution via the dash prefix, comment handling (both HTML comments and unrendered comments), filters for transforming content blocks (such as :markdown, :less, :coffee), and support for both string and file-based template compilation. Pug is commonly used with Express.js via the pug package and integrates with Webpack, Gulp, and other build tools. As of 2026, Pug has over 21,000 GitHub stars.

Tags & Categories

Categories

Tags

Statistics

1
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!