
It even lets you place tags in the middle of words. The value here is that it gives you full control over whether tags and/or plain text should touch. You can right now try the fix on the branch include-script (use the version 'dev-include-script' in composer), this will be merged with the version 2.3. Note that pug-assets use pug-minify (a keyword that you can also use alone). So…Pug drops the whitespace between tags, but keeps the whitespace inside them. But it can also be used without, I will fix the README.

You just need to remember two main points about how whitespace works.

Don’t worry, though, you’ll get the hang of it soon enough. Managing the whitespace of the rendered HTML is one of the trickiest parts about learning Pug. app.This text belongs to the paragraph tag.This text belongs to the div tag.

Within your Express route, you can then render your Pug files by calling the res.render function with the path of the file (starting from the directory set by the app.set("views") option). app.set("view engine", "pug") įurther, you must set the view directory of your app so that Express knows where to look for your Pug files (for compilation).

However, you must set the view engine property of your Express application to pug. If you are using Express in your application, you do not need to require("pug"). You can now use pug in your project through the standard require mechanism: const pug = require("pug") Run npm install pug -save to install the pug module to your current project.Have the Node.js environment installed on your machine.To install the Pug template rendering system, follow these steps: When you run this file with npm main.js, you should get the following HTML code output in your console: Hello World, John!Ĭongratulations, you just created and compiled your first template! On to more advanced stuff, such as Conditionals, Iteration, and much more! Installation First, let's create a template to be rendered! p Hello World, #)
