Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/jquery.mustache.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
domTemplateType: 'text/html',

// Specifies the `dataType` attribute used when external templates are loaded.
externalTemplateDataType: 'text'
externalTemplateDataType: 'text',

// If set to true, it will force requested pages not to be cached by the browse, useful during development
forceReload: false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cacheTemplates?

};

function getMustache() {
Expand Down Expand Up @@ -134,10 +137,14 @@
* ready for use.
*/
function load(url, onComplete) {
return $.ajax({
url: url,
dataType: options.externalTemplateDataType
}).done(function (templates) {
var _options = {
url: url,
dataType: options.externalTemplateDataType
};
if(options.forceReload) {
_options.cache = false;
}
return $.ajax(_options).done(function (templates) {
$(templates).filter('script').each(function (i, el) {
add(el.id, $(el).html());
});
Expand Down