How to use jade - 10 common examples

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 popeindustries / buddy / packages / buddy-plugin-jade / index.js View on Github external
exports.compile = function (content, options, fn) {
  // Copy data to root
  options = Object.assign({}, options, DEFAULT_OPTIONS, options.data);

  jade.render(content, options, (err, content) => {
    if (err) {
      err.filepath = options.filepath;
      return fn(err);
    }
    fn(null, content);
  });
};
github youngsterxyf / redis-sentinel-ui / utils / template.js View on Github external
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);
}
github ryan-roemer / backbone-testing / vendor / mocha.js View on Github external
function HTMLCov(runner) {
  var jade = require('jade')
    , file = __dirname + '/templates/coverage.jade'
    , str = fs.readFileSync(file, 'utf8')
    , fn = jade.compile(str, { filename: file })
    , self = this;

  JSONCov.call(this, runner, false);

  runner.on('end', function(){
    process.stdout.write(fn({
        cov: self.cov
      , coverageClass: coverageClass
    }));
  });
}
github bitovi / testee / examples / mocha / lib / mocha.js View on Github external
function HTMLCov(runner) {
			var jade = require('jade')
				, file = __dirname + '/templates/coverage.jade'
				, str = fs.readFileSync(file, 'utf8')
				, fn = jade.compile(str, { filename: file })
				, self = this;

			JSONCov.call(this, runner, false);

			runner.on('end', function(){
				process.stdout.write(fn({
					cov: self.cov
					, coverageClass: coverageClass
				}));
			});
		}
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 charlesXu86 / Chatbot_CN / Chatbot_Web / AdminLTE / bower_components / mocha / mocha.js View on Github external
function HTMLCov(runner) {
  var jade = require('jade')
    , file = __dirname + '/templates/coverage.jade'
    , str = fs.readFileSync(file, 'utf8')
    , fn = jade.compile(str, { filename: file })
    , self = this;

  JSONCov.call(this, runner, false);

  runner.on('end', function(){
    process.stdout.write(fn({
        cov: self.cov
      , coverageClass: coverageClass
    }));
  });
}
github riquito / valib / web / js / ext / mocha.js View on Github external
function HTMLCov(runner) {
  var jade = require('jade')
    , file = __dirname + '/templates/coverage.jade'
    , str = fs.readFileSync(file, 'utf8')
    , fn = jade.compile(str, { filename: file })
    , self = this;

  JSONCov.call(this, runner, false);

  runner.on('end', function(){
    process.stdout.write(fn({
        cov: self.cov
      , coverageClass: coverageClass
    }));
  });
}
github WayneYe / ScrumPoker / node_modules / mocha / _mocha.js View on Github external
function HTMLCov(runner) {
  var jade = require('jade')
    , file = __dirname + '/templates/coverage.jade'
    , str = fs.readFileSync(file, 'utf8')
    , fn = jade.compile(str, { filename: file })
    , self = this;

  JSONCov.call(this, runner, false);

  runner.on('end', function(){
    process.stdout.write(fn({
        cov: self.cov
      , coverageClass: coverageClass
    }));
  });
}
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