![]() ![]() If you choose to use any other template engine, it wouldn't be 'pug' you put above, rather, it would be your chosen engine.Īnd as to regards the 'Views', it tells express where to find our views (Our html pages), however the default setting is basically our main directory and the 'Views' folder (You could check the docs for more understanding). The 'View Engine' above tells express which template engine that is being used in the project. ![]() You simply use it in your project such like: Now, it gets a little tricky, why? Because you don't have to require pug from node module with 'require' keyword. You install the Pug template engine with the above command (npm install -save pug) and node does the installation in no time.įrom then on, you must have had an app.js file in your project. Pug is just one of the many template engines available, and just to mention a few, we have EJS, HANDLEBARS, MUSTACHE etc.įirst, Pug can be installed from your computer terminal or directly from your terminal in VS code! Implementing it into your project can be quite easy and it is makes your code concise and easy to read and follow through. Pug is an HTML templating engine, which means you can write much simpler Pug code, which Pug compiler will compile into HTML code, that browser can understand. ![]() NB: This does not include your programming logic in your express files, it just shows how to install, implement and render your page on the browser It is assumed that you have some knowledge in Node.js and Express for you to really understand this article. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |