Answer the question
In order to leave comments, you need to log in
How to precompile Pug (Jade) templates in a NodeJS + Express.js application?
Hello!
There is a web application running in Node.js + Express.js + Pug bundle . You can set the environment variable " NODE_ENV=production ", then the Pug template engine will cache already compiled templates. But I want to immediately slip the precompiled application templates so that the optimization is already on the 1st launch.
How can I do that?
Answer the question
In order to leave comments, you need to log in
In general, the options, as I understand it, are:
1. Accept and just use the environment variable "NODE_ENV=production"
2. Use the express-pug-cache-helper package . But here we need 2 instances of express. One is for basic work, the other is for template caching.
3. Use precompilation of templates with crutches, then replace the template engine with production.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question