Added build ts to js an css load ro avoid cache problem after updates
authorKiwiIRC <kiwiirc@ns352438.ovh.net>
Tue, 17 Jun 2014 23:32:24 +0000 (01:32 +0200)
committerKiwiIRC <kiwiirc@ns352438.ovh.net>
Tue, 17 Jun 2014 23:32:24 +0000 (01:32 +0200)
client/build.js
client/src/index.html.tmpl

index e7c4b2eada5dc7dfb859974d52a2703aa23a064c..4f6cab79384d2e92e4bd4a1c4aeae4714cec8c81 100644 (file)
@@ -219,11 +219,13 @@ fs.readdir(__dirname + '/src/translations', function (err, translation_files) {
 /**\r
  * Build the index.html file\r
  */\r
+var build_time = new Date().getTime();\r
 \r
 var index_src = fs.readFileSync(__dirname + '/src/index.html.tmpl', FILE_ENCODING)\r
     .replace(new RegExp('<%base_path%>', 'g'), config.get().http_base_path || '')\r
-    .replace(new RegExp('<%build_version%>', 'g'), package_json.version);\r
-\r
+    .replace(new RegExp('<%build_version%>', 'g'), package_json.version)\r
+    .replace(new RegExp('<%build_time%>', 'g'), build_time);\r
+    \r
 fs.writeFile(__dirname + '/index.html', index_src, { encoding: FILE_ENCODING }, function (err) {\r
     if (!err) {\r
         console.log('Built index.html');\r
index 1d59ce42fce7aaa343b4603c3822a35c9fc0e354..1d796fc7c5b9b2836b1f31eb3dd8405b6bfbf5ab 100644 (file)
@@ -9,7 +9,7 @@
 \r
 <link rel="shortcut icon" href="<%base_path%>/assets/img/favicon.ico">\r
 \r
-<link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/style.css" />\r
+<link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/style.css?t=<%build_time%>" />\r
 <link rel="stylesheet" type="text/css" href="<%base_path%>/assets/css/font-awesome.min.css" />\r
 </head>\r
 <body>\r
 \r
         // If we're not interested in debug libs, start loading production files\r
         if (!getQueryVariable('debug')) {\r
-            scripts.push(['assets/libs/lodash.min.js']);\r
+            scripts.push(['assets/libs/lodash.min.js?t=<%build_time%>']);\r
             scripts.push([\r
-                'assets/libs/backbone.min.js',\r
-                'assets/libs/jed.js'\r
+                'assets/libs/backbone.min.js?t=<%build_time%>',\r
+                'assets/libs/jed.js?t=<%build_time%>'\r
             ]);\r
             scripts.push([\r
-                'assets/kiwi.min.js',\r
-                'assets/libs/engine.io.bundle.min.js'\r
+                'assets/kiwi.min.js?t=<%build_time%>',\r
+                'assets/libs/engine.io.bundle.min.js?t=<%build_time%>'\r
             ]);\r
 \r
             loadNextScript();\r