Sammy.js How to disable caching template html?

2.5k Views Asked by At

Sammy.js seems to be caching html templates used to load pages using context render

context.render(context.view('pages/new'), data)

Which is good in production setup. But during development it is pain to clear browser cache every time new.html is changed on the server.

Is there a way to disable all caching on Sammy.js ?

3

There are 3 best solutions below

1
On

When you load a template into the context you can provide the option {cache: false} as the second parameter to load method.

http://sammyjs.org/docs/api/0.7.0/all#Sammy.EventContext-load

0
On

i was having an annoying trouble with mustache templates caching. It seems this issue is not because of sammy templating system but because of chrome caching

so go to settings/general tab (you have to show developer tools and click on cogwheel in the bottom right corner) and click on disable cache.

please check this post i found for further help http://harrywolff.com/fix-mustache-templates-from-being-cached/

hope this works for you, it helped me a lot.

0
On