How to use dot - 10 common examples

To help you get started, we’ve selected a few dot 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 sigoden / htte / packages / htte-reporter-html / src / index.js View on Github external
function render(data) {
  let templateStr = fs.readFileSync(path.resolve(__dirname, 'index.html'), 'utf8');
  let tempFn = dot.template(templateStr);
  return tempFn(data);
}
github fabric8io-images / fish-pepper / fp / template-engine.js View on Github external
files.forEach(function (file) {
        var path = sub ? sub + "/" + file : file;
        if (fs.statSync(templ_dir + "/" + path).isDirectory()) {
          recurseRead(path);
        } else {
          var template = {
            "templ": dot.template(fs.readFileSync(templ_dir + "/" + path)),
            "file":  path,
            "dir":   sub
          };
          isMappedFile(file) ? mappedFileTemplates.push(template) : parsedTemplates.push(template);
        }
      });
    })();
github stackoverflow / blode / lib / main.js View on Github external
var loadPost = function(fpath) {
  var data = fs.readFileSync(fpath, "utf-8");
  var defs = dotUtils.findDefs(data);
  data = dot.template(data)();
  return {"data": isHtml(fpath) ? data : md(data), "defs": defs};
};
github fabric8io-images / fish-pepper / fp / template-engine.js View on Github external
files.forEach(function (file) {
      var base = path.parse(file).base;
      var toCopy = fs.readFileSync(file);
      var newContent = (dot.template(toCopy))(templateContext);
      var targetFile = getPath(paramValues, base);
      var oldContent = fs.existsSync(targetFile) ? fs.readFileSync(targetFile) : undefined;
      if (!oldContent || oldContent != newContent) {
        fs.writeFileSync(targetFile, newContent);
        logFile(file, oldContent ? "NEW".yellow : "CHANGED".green, key);
      }
    });
  }
github RagnarDanneskjold / AirWallet / blockexplorer.js View on Github external
function generateTemplate(input, output, defs) {
  var template = doT.template(fs.readFileSync(__dirname + '/views/' + input, 'utf8'), null, defs);
  fs.writeFileSync(__dirname + '/views/' + output, template.toString());
}
github bkchain / bkchain.org / blockexplorer.js View on Github external
function generateTemplate(input, output, defs) {
  var template = doT.template(fs.readFileSync(__dirname + '/views/' + input, 'utf8'), null, defs);
  fs.writeFileSync(__dirname + '/views/' + output, template.toString());
}
github Katahdin / dot-packer / index.js View on Github external
function convert(fileName, namespace){
	var path = program.dir + fileName;
	var data = fs.readFileSync(path, program.encoding);
    var code = dot.template(data).toString();
    var header = namespace+"['"+fileName.replace('.jst','')+"'] = function(it)";
    code = code.replace(/function anonymous\([^\)]+\)/, header)+";";
	return code;
}
github cstigler / express-dot / express-dot.js View on Github external
return fs.readFile(filename, 'utf8', function(err, str) {
    if (err) return cb(err);

    var template = doT.template(str, null, _globals);
    if (options.cache) _cache[filename] = template;
    return cb(null, template.call(_globals, options));
  });
}
github gethuman / pancakes / lib / client.generator.js View on Github external
lodash.each(templateFiles, function (fileName) {
    var file = fs.readFileSync(__dirname + '/../templates/' + fileName, encoding);
    templates[fileName] = dot.template(file);
});
github cstigler / express-dot / express-dot.js View on Github external
return fs.readFile(layoutFileName, 'utf8', function(err, str) {
    if (err) return cb(err);

    var layoutTemplate = doT.template(str, null, _globals);
    if (options.cache) _cache[layoutFileName] = layoutTemplate;

    return _renderWithLayout(filename, layoutTemplate, options, cb);
  });
};

dot

Concise and fast javascript templating compatible with nodejs and other javascript environments

MIT
Latest version published 4 years ago

Package Health Score

62 / 100
Full package analysis

Popular dot functions