From: KiwiIRC Date: Tue, 17 Jun 2014 23:32:24 +0000 (+0200) Subject: Added build ts to js an css load ro avoid cache problem after updates X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ac823215f01b53d8fe3d1de740927f66897f21f2;p=KiwiIRC.git Added build ts to js an css load ro avoid cache problem after updates --- diff --git a/client/build.js b/client/build.js index e7c4b2e..4f6cab7 100644 --- a/client/build.js +++ b/client/build.js @@ -219,11 +219,13 @@ fs.readdir(__dirname + '/src/translations', function (err, translation_files) { /** * Build the index.html file */ +var build_time = new Date().getTime(); var index_src = fs.readFileSync(__dirname + '/src/index.html.tmpl', FILE_ENCODING) .replace(new RegExp('<%base_path%>', 'g'), config.get().http_base_path || '') - .replace(new RegExp('<%build_version%>', 'g'), package_json.version); - + .replace(new RegExp('<%build_version%>', 'g'), package_json.version) + .replace(new RegExp('<%build_time%>', 'g'), build_time); + fs.writeFile(__dirname + '/index.html', index_src, { encoding: FILE_ENCODING }, function (err) { if (!err) { console.log('Built index.html'); diff --git a/client/src/index.html.tmpl b/client/src/index.html.tmpl index 1d59ce4..1d796fc 100644 --- a/client/src/index.html.tmpl +++ b/client/src/index.html.tmpl @@ -9,7 +9,7 @@ - + @@ -554,14 +554,14 @@ // If we're not interested in debug libs, start loading production files if (!getQueryVariable('debug')) { - scripts.push(['assets/libs/lodash.min.js']); + scripts.push(['assets/libs/lodash.min.js?t=<%build_time%>']); scripts.push([ - 'assets/libs/backbone.min.js', - 'assets/libs/jed.js' + 'assets/libs/backbone.min.js?t=<%build_time%>', + 'assets/libs/jed.js?t=<%build_time%>' ]); scripts.push([ - 'assets/kiwi.min.js', - 'assets/libs/engine.io.bundle.min.js' + 'assets/kiwi.min.js?t=<%build_time%>', + 'assets/libs/engine.io.bundle.min.js?t=<%build_time%>' ]); loadNextScript();