Prevent caching of underline patterns processed by the requirejs text plugin

I use the requirejs text plugin to load templates and then evaluate in views. The problem is that the templates are cached. That way, until I clear the cache, templates that always display have old content.

I assume the requirejs text plugin caches text patterns. Is there any way to stop this?

+4
source share
1 answer

It is very simple and documented on the RequireJS page. All you have to do is add urlArgs to your require.config:

urlArgs: "bust=" + (new Date()).getTime()

Please note that, as explained in the documentation, the above code is for development environments only, and you need to either delete it or set the version number for your production code. This can also be easily done if you use some kind of back end, as you can always enter that value into the template system.

http://requirejs.org/docs/api.html#config-urlArgs

+1
source

All Articles