Skip to content
This repository
Browse code

Docs

  • Loading branch information...
commit 0338a831c23e89c2251b56929fbef7900c0d1b94 1 parent fc61f29
Ray Morgan authored

Showing 2 changed files with 21 additions and 3 deletions. Show diff stats Hide diff stats

  1. +20 2 lib/mu.js
  2. +1 1  package.json
22 lib/mu.js
@@ -130,10 +130,28 @@ mu.renderText = function (template, view, partials) {
130 130 return beginRender(tokens, view, partials);
131 131 }
132 132
133   -mu.clearCache = function () {
134   - mu.cache = {};
  133 +/**
  134 + * Clears all of the cache or a specific template.
  135 + *
  136 + * @param templateName String If provided only that template is removed from
  137 + * the cache, else everything is.
  138 + */
  139 +mu.clearCache = function (templateName) {
  140 + if (name) {
  141 + delete mu.cache[templateName];
  142 + } else {
  143 + mu.cache = {};
  144 + }
135 145 };
136 146
  147 +/**
  148 + * Compiles the template and then renders it. Uses the cache if it
  149 + * is available.
  150 + *
  151 + * @param templateName String The name of the template to render
  152 + * @param view Object The view object to inject into the template upon render
  153 + * @returns Stream THe output stream
  154 + */
137 155 mu.compileAndRender = function (templateName, view) {
138 156 var stream = new Stream();
139 157 var parsed = mu.cache[templateName];
2  package.json
... ... @@ -1,4 +1,4 @@
1   -{ "name": "mustache-mu"
  1 +{ "name": "mu2"
2 2 , "description": "A Mustache template engine for Node.js"
3 3 , "keywords": ["template", "mustache"]
4 4 , "version" : "0.5.4"

0 comments on commit 0338a83

Please sign in to comment.
Something went wrong with that request. Please try again.