In this part of the pug tutorial series we will learn how to run pug
files.
Some basics of pug
files include the following :
.pug
.
p
in pug
in place of <p>
tag in html.
Let see how the code snippet for hello world
program will look like in pug.
doctype html
html(lang='en')
head
title Nodejsera Pug tutorial series
body
h1 Hello World
We can run the above code using the following command in your file directory:
>pug hello-world.pug
rendered hello-world.html
.html
extension. The corresponsding HTML files will be created right next to the pug one.
<!-- Name of the File : hello-world.html -->
<!DOCTYPE html >
<html lang="en">
<head>
<title>Nodejsera Pug tutorial series</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
The screenshot of the above code is as follows :