Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _render(relativePath, data) {
// templateCache = {};
let filePath = path.join(global.RootDir, relativePath);
if (!(filePath in templateCache)) {
templateCache[filePath] = jade.compileFile(filePath, {
pretty: true
});
}
return templateCache[filePath](data);
}
function render(relativePath, data) {
var filePath = path.join(global.RootDir, relativePath);
if (!templateCache.hasOwnProperty(filePath)) {
templateCache[filePath] = jade.compileFile(filePath, {pretty: true});
}
return templateCache[filePath](data);
}
function renderJade(filepath, locals) {
var env = process.env.NODE_ENV;
if (env === 'production') {
if (!viewCache[filepath]) {
viewCache[filepath] = jade.compileFile(filepath);
}
return viewCache[filepath](locals);
}
return jade.renderFile(filepath, locals);
}
function renderJade(filepath,locals){
var env = process.env.NODE_ENV;
if( env ==='production' ){
if(!viewCache[filepath]){
viewCache[filepath] = jade.compileFile(filepath);
}
return viewCache[filepath](locals);
}else{
return jade.renderFile(filepath,locals);
}
}
function doCompile(srcRelativePath, lang) {
let srcAbsolutePath = path.resolve(projectDir, srcRelativePath);
let compiledFunction = jade.compileFile(srcAbsolutePath);
return compiledFunction({
buildVersion: config.buildVersion,
lang: lang,
host: config.host,
blogPath: config.blogPath,
mainSitePath: config.mainSitePath
});
}