Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

forcing RequireJS text! to reload

Using the text! plugin, is there a way of forcing RequireJS to reload a file rather than returning the cached data?

like image 874
nicholas Avatar asked Feb 15 '12 23:02

nicholas


People also ask

Is RequireJS synchronous?

So, RequireJS doesn't support it. From your use case it seems that you don't need synchronous RequireJS, you need to return result asynchronously. AMD pattern allows to define dependencies and load them asynchronously, but module's factory function must return result synchronously.

What is Shim RequireJS?

shim: Configure the dependencies, exports, and custom initialization for older, traditional "browser globals" scripts that do not use define() to declare the dependencies and set a module value. Here is an example. It requires RequireJS 2.1. 0+, and assumes backbone. js, underscore.

How do I use require config?

RequireJS can be initialized by passing the main configuration in the HTML template through the data-main attribute. It is used by RequireJS to know which module to load in your application. To include the Require. js file, you need to add the script tag in the html file.

What is define () in JS?

The define() function can be used to load the modules (module can be an object, function, class or a code which is executed after loading a module). You can load different versions of the same module in the same page.


1 Answers

RequireJS will only cache the file per request. A page reload will fetch it again. If you see something different it is because:

  • Either you have caching on your server.
  • or your browser caches the request. You can of course disable this on your browser.

If you want browsers to fetch a clean file every time, you should have a no-cache header for these resources on your server.

like image 72
ggozad Avatar answered Oct 09 '22 17:10

ggozad