Skip to content

forceReload #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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