Permalink
Browse files

Docs

  • Loading branch information...
1 parent fc61f29 commit 0338a831c23e89c2251b56929fbef7900c0d1b94 @raycmorgan committed Jan 5, 2012
Showing with 21 additions and 3 deletions.
  1. +20 −2 lib/mu.js
  2. +1 −1 package.json
View
22 lib/mu.js
@@ -130,10 +130,28 @@ mu.renderText = function (template, view, partials) {
return beginRender(tokens, view, partials);
}
-mu.clearCache = function () {
- mu.cache = {};
+/**
+ * Clears all of the cache or a specific template.
+ *
+ * @param templateName String If provided only that template is removed from
+ * the cache, else everything is.
+ */
+mu.clearCache = function (templateName) {
+ if (name) {
+ delete mu.cache[templateName];
+ } else {
+ mu.cache = {};
+ }
};
+/**
+ * Compiles the template and then renders it. Uses the cache if it
+ * is available.
+ *
+ * @param templateName String The name of the template to render
+ * @param view Object The view object to inject into the template upon render
+ * @returns Stream THe output stream
+ */
mu.compileAndRender = function (templateName, view) {
var stream = new Stream();
var parsed = mu.cache[templateName];
View
2 package.json
@@ -1,4 +1,4 @@
-{ "name": "mustache-mu"
+{ "name": "mu2"
, "description": "A Mustache template engine for Node.js"
, "keywords": ["template", "mustache"]
, "version" : "0.5.4"

0 comments on commit 0338a83

Please sign in to comment.