Skip to content

Commit

Permalink
add support for caching templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir committed Oct 4, 2012
1 parent 4b9e76b commit 05db2ce
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 55 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ This method allows you to predefine some settings so you wont need to repeat the
* **cfg** {Object}
* **URLConvertor ** {Function} global function to convert a template name to a URL. this method will be called if you don’t provide a **URLConvertor** in the **generateHTML** method and the template manager requires to have a URL from a template name.
* **fetcher** {Function} global callback to fetch templates.
* **cacheTemplates** {Boolean} if this is true then ensureLocal will check the templates BabaJS already loaded.
* **context** {Object} global context for all callback function you provide
* **dep** {Object} This allows you to set a dependency hierarchy for templates. the object is a key/value pair where the key=template name and the value=is an object with templates,js,css which are all arrays of dependency files. Before BabaJS will generate an HTML from a template it will check all the dependencies it has in and will make sure all of them are loaded. The dependencies can have two or more dependencies pointing to each other (no endless loop here), so temp1 could have temp2 as a dependency and temp2 can have temp1 as a dependency, BabaJS will fetch temp1 and temp2 whenever you request temp1 or temp2 if they are not stored locally.
* **flagCb** {Function} callback hook for formatting flags. the function gets two parameter. The first {String} the output string to be formatted, and the second one {Array} with all the parameters you set for this flag. If this function return a string then this is the string that BabaJS will return as a final result. If no string is returned then BabaJS return the original string.
Expand Down
Loading

0 comments on commit 05db2ce

Please sign in to comment.