cache compiled function for templates

merge-requests/208/head
fatchan 5 years ago
parent 54ff8b8c0e
commit 9aff8a6031
  1. 2
      helpers/render.js

@ -7,6 +7,6 @@ const outputFile = require('fs-extra').outputFile
, templateDirectory = path.join(__dirname+'/../views/pages/');
module.exports = async (htmlName, templateName, options) => {
const html = pug.renderFile(`${templateDirectory}${templateName}`, options);
const html = pug.renderFile(`${templateDirectory}${templateName}`, { ...options, cache: true });
return outputFile(`${uploadDirectory}html/${htmlName}`, html);
};

Loading…
Cancel
Save