


After sweating bullets, to my relief I got a call from him spewing that he had already listened to it a billion times and loved it. In fact his wife apparently was getting sick of hearing it in the car that weekend. Pug fully integrates with Express, a popular Node.js web framework, as a supported view engine.

In Express, the environmental variable NODE_ENV is designed to inform the web application of the execution environment: whether it is in development or in production.Ĭheck out Express’s excellent guide for how to integrate Pug with Express. Express and Pug automatically modify the defaults of a few options in production environment, to provide a better out-of-the-box experience for users. Let us first start by creating a node.js project named pug. Specifically, when _ENV is set to 'production', and Pug is used with Express, the compileDebug option is false by default, while the cache option is true. For that let’s create the folder named pug and run the command npm init in it. Now that we have set up our project, let’s now install the necessary packages. To override the defaults for compileDebug and cache, you can set the respective property in app.locals or res.locals objects to true or false.įirst, we install Express.js, to install we will run the command: npm install express -save Next, we will install pug. The cache option can also be overriden through Express’s app.disable/ enable('view cache').įor more details, check Express’s API reference.
