RequireJS - markhowellsmead/helpers GitHub Wiki
RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node.
The usual way to load JavaScript modules using RequireJS is via the data-main
attribute on the script tag.
If you need to force the client to load the newest version of the app.js file and the newest version of all the module files, use versioning as follows.
<script data-main="assets/js/app.1.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script>
<script>
var requirejs;
requirejs.config({
urlArgs: "bust=1.0.0"
});
</script>
For Apache. Tells the server to answer a request for assets/js/app.1.0.0.js by sending assets/js/app.js to the client.
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(js)$ $1.$3 [L]
</IfModule>