From 65904ffbdebc861a45c1b504d244d02a12f4561b Mon Sep 17 00:00:00 2001 From: Fabian Lange Date: Wed, 23 Jul 2014 22:40:35 +0200 Subject: Appending query param with vaadin version to js files (#12210) while #7868 is supposed to solve the overall issue, this solves a big part of the upgrade + cached files issues quickly. When I use vaadin themes, I have control over how they are included, so I can add a vaadin version number to it. For the default JS I cannot. Change-Id: Ica1cddee417946aa32116eb09882a3dc6c2924a6 --- WebContent/VAADIN/vaadinBootstrap.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'WebContent') diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js index ced077138f..53b213e110 100644 --- a/WebContent/VAADIN/vaadinBootstrap.js +++ b/WebContent/VAADIN/vaadinBootstrap.js @@ -18,13 +18,19 @@ log = console.log; } - var loadTheme = function(url) { + var loadTheme = function(url, version) { if(!themesLoaded[url]) { - log("loadTheme", url); + log("loadTheme", url, version); + + var href = url + '/styles.css'; + if (version) { + href += '?v=' + version; + } + var stylesheet = document.createElement('link'); stylesheet.setAttribute('rel', 'stylesheet'); stylesheet.setAttribute('type', 'text/css'); - stylesheet.setAttribute('href', url + "/styles.css"); + stylesheet.setAttribute('href', href); document.getElementsByTagName('head')[0].appendChild(stylesheet); themesLoaded[url] = true; } @@ -200,8 +206,10 @@ var bootstrapApp = function(mayDefer) { var vaadinDir = getConfig('vaadinDir'); + var versionInfo = getConfig('versionInfo'); + var themeUri = vaadinDir + 'themes/' + getConfig('theme'); - loadTheme(themeUri); + loadTheme(themeUri, versionInfo && versionInfo['vaadinVersion']); var widgetset = getConfig('widgetset'); var widgetsetUrl = getConfig('widgetsetUrl'); -- cgit v1.2.3