How to use the jade.renderFile function in jade

To help you get started, we’ve selected a few jade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / mongoose / docs / website.js View on Github external
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);
    });
  });
}
github stormpath / express-stormpath / lib / helpers / render.js View on Github external
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);
}
github stormpath / express-stormpath / lib / helpers.js View on Github external
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);
  }
}

jade

A clean, whitespace-sensitive template language for writing HTML

MIT
Latest version published 9 years ago

Package Health Score

58 / 100
Full package analysis