--- language: Pug contributors: - ["Michael Warner", "https://github.com/MichaelJGW"] filename: index.pug --- ## Getting Started with Pug Pug is a little language that compiles into the HTML. It has cleaner syntax with additional features like if statements and loops. It can also be used as a server side templating language for server languages like NodeJS. ### The Language ```pug //- Single Line Comment //- Multi Line Comment //- ---TAGS--- //- Basic div //-
h1 //- my-customTag //-
- let disabled = false
input(type="text" disabled=disabled)
//-
- disabled = true
input(type="text" disabled=disabled)
//-
//- JS Templating
- const name = "Bob";
h1 Hi #{name}
h1= name
//- 1
2
3
each value, index in [1,2,3] p=value + '-' + index //-1-0
2-1
3-2
each value in [] p=value //- each value in [] p=value else p No Values are here //-No Values are here
//- ---CONDITIONALS--- - const number = 5 if number < 5 p number is less then 5 else if number > 5 p number is greater then 5 else p number is 5 //-number is 5
- const orderStatus = "Pending"; case orderStatus when "Pending" p.warn Your order is pending when "Completed" p.success Order is Completed. when -1 p.error Error Occurred default p No Order Record Found //-Your order is pending
//- --INCLUDE-- //- File path -> "includes/nav.png" h1 Company Name nav a(href="index.html") Home a(href="about.html") About Us //- File path -> "index.png" html body include includes/nav.pug //-