How to use the mustache.clearCache function in mustache

To help you get started, we’ve selected a few mustache 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 5thWall / mustache-render / tasks / mustache_render.js View on Github external
}
        } else if (data !== undefined && template) {
          return fileData;
        } else {
          throw new Error("Please specify data and template for each file");
        }
      }).filter(Boolean);

      if (files.length < 1) {
        grunt.log.error("Nothing to do (are sources correctly specified?)");
        return;
      }

      var renderer = new GMR(this.options);

      if (renderer.options.clear_cache) { mustache.clearCache(); }

      if (renderer.options.escape === true) {
        mustache.escape = escapeHtml;
      } else if (renderer.options.escape === false) {
        mustache.escape = function (text) { return text; };
      } else if (typeof renderer.options.escape === 'function') {
        mustache.escape = renderer.options.escape;
      } else {
        throw new Error("escape must be true, false, or a function");
      }

      var done = (function (gruntDone) {
        return function (success) {
          mustache.escape = escapeHtml;  // do not leak custom escape function
          gruntDone(success);
        };
github userpixel / micromustache / perf / cases / mustache.js View on Github external
function render(obj) {
  mustache.clearCache()
  return mustache.render(
    'Hi, My name is {{name}}! I am {{age}} years old and live in {{cities.1}}. In {{cities.1}}, foo is {{nested.foo}}. My favorite book is {{books.0.name}} by {{books.0.author}}. ({{books.0.year}}) is not defined.',
    obj
  )
}
github nusmodifications / nusmods / www / src / js / ssr / server.js View on Github external
fs.readFile(this.templatePath, 'utf-8').then((file) => {
      this.template = file;

      Mustache.clearCache();
      Mustache.parse(file);
    });
github userpixel / micromustache / examples / perf.js View on Github external
function mustache_render(obj) {
  mustache.clearCache()
  return mustache.render(
    'Hi, My name is {{name}}! I am {{age}} years old and live in {{cities.1}}. foo is {{nested.foo}}.',
    obj
  )
}