Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function jadeify (filename, options) {
options || (options = {});
options.package = package;
options.linktype = linktype;
options.href = href;
options.klass = klass;
jade.renderFile(filename, options, function (err, str) {
if (err) return console.error(err.stack);
var newfile = filename.replace('.jade', '.html')
fs.writeFile(newfile, str, function (err) {
if (err) return console.error('could not write', err.stack);
console.log('%s : rendered ', new Date, newfile);
});
});
}
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);
}
}