Introduction to Pug syntax
A HTML response that responsed by the web server application is create by HTML template engine.
In this article, learning the syntax of the HTML template engine Pug
.
Introduction
Pug is an HTML template engine. It use with Express.js.
Prerequisite
OS
Not required macOS. But this article depends it.
|
|
Software
In this article, it depends on the below software:
- Pug v3.0.0
- Pug CLI v1.0.0-alpha6
Install with NPM.
|
|
Directory
It doesn't have to be this way, but I'm writing with this assumption.
|
|
package.json
|
|
Build html
Run it.
|
|
Syntax
variable
Pug code
|
|
Result
|
|
comment
Pug code
|
|
Result
|
|
if
Pug code
|
|
Result
|
|
for
Pug code
|
|
Result
|
|
Note
|
|
foreach
Pug code
|
|
Result
|
|
switch
Pug code
|
|
Result
|
|
Conclusion
This post has reviewed the basic syntax of Pug.
Pug has other syntaxes as follows:
If you are interested, try to read it.