![]() ![]() Recall the following code from my: Build a Weather Website in 30 minutes with Node.js + Express + OpenWeather tutorial where we used EJS as our template language: // TERMINAL npm install ejs -save // SERVER.JS app.set('view engine', 'ejs') The same way we use other template engines. In short: At run time, Pug (and other template engines) replace variables in our file with actual values, and then send the resulting HTML string to the client. ![]() ![]() To understand Pug, you need to remember that the browser reads HTML and CSS and then displays formatted images and text to the client based on what that HTML and CSS tells it to do.Ī template engine allows us to inject data and then produce HTML. I strongly encourage you to check out those links before proceeding. Here is the tutorial, and Here is the full code on GitHub. In this tutorial, we’re going to be examining a weather website that I previously built with Node.js, Express JS, EJS, and OpenWeatherMap’s API. Its syntax is aesy to learn.I laughed at this picture for a long time - via Prerequisites ![]() Pug uses whitespaces and indentation as the part of the syntax. Let's learn how to use pug template engine in Node.js application using Express.js. Let's take a template engine pug (formerly known as jade). For example, to use the Pug template engine: app.set('view engine', 'pug').
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |