From 3bb5d0a70fd149d2edfbf45233b03fed80ec748a Mon Sep 17 00:00:00 2001 From: Michiel Pater Date: Tue, 17 Aug 2021 00:30:22 +0200 Subject: [PATCH 1/5] Feature: Cache busting website data (JavaScript and SVG files) by adding '?version' to these filenames --- docs/assets/js/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/assets/js/script.js b/docs/assets/js/script.js index f12c4ca15..a684dd59b 100644 --- a/docs/assets/js/script.js +++ b/docs/assets/js/script.js @@ -28,7 +28,7 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) { var baseUrl = `https://cdn.jsdelivr.net/gh/${gitHubPath}/` // Get devicon.json - $http.get(baseUrl + '/devicon.json').success(function(data) { + $http.get(baseUrl + '/devicon.json?' + $scope.latestReleaseTagging).success(function(data) { /* | Re-format devicon.json @@ -126,7 +126,7 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) { */ $scope.selectSvg = function(svgVersion, index) { - $http.get(baseUrl + '/icons/' + $scope.selectedIcon.name + '/' + $scope.selectedIcon.name + '-' + svgVersion + '.svg').success(function(data){ + $http.get(baseUrl + '/icons/' + $scope.selectedIcon.name + '/' + $scope.selectedIcon.name + '-' + svgVersion + '.svg?' + $scope.latestReleaseTagging).success(function(data){ var svgElement = angular.element(data); var innerSvgElement = null; From 0a1d2c586362d9a65196ab428b66dec63a88d27b Mon Sep 17 00:00:00 2001 From: Michiel Pater Date: Tue, 17 Aug 2021 01:05:48 +0200 Subject: [PATCH 2/5] Updated script.js to use CDN versioning style --- docs/assets/js/script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/assets/js/script.js b/docs/assets/js/script.js index a684dd59b..8625a098b 100644 --- a/docs/assets/js/script.js +++ b/docs/assets/js/script.js @@ -13,7 +13,8 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) { // which is used for showing in the header of the page // as well as for CDN links var gitHubPath = 'devicons/devicon'; - var url = 'https://api.github.com/repos/' + gitHubPath + '/tags'; + var versionStr = '@' + $scope.latestReleaseTagging; + var url = 'https://api.github.com/repos/' + gitHubPath + versionStr + '/tags'; $scope.latestReleaseTagging = 'master'; $http.get(url).success(function (data) { @@ -25,10 +26,10 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) { }); - var baseUrl = `https://cdn.jsdelivr.net/gh/${gitHubPath}/` + var baseUrl = `https://cdn.jsdelivr.net/gh/${gitHubPath}${versionStr}/` // Get devicon.json - $http.get(baseUrl + '/devicon.json?' + $scope.latestReleaseTagging).success(function(data) { + $http.get(baseUrl + '/devicon.json').success(function(data) { /* | Re-format devicon.json @@ -126,7 +127,7 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) { */ $scope.selectSvg = function(svgVersion, index) { - $http.get(baseUrl + '/icons/' + $scope.selectedIcon.name + '/' + $scope.selectedIcon.name + '-' + svgVersion + '.svg?' + $scope.latestReleaseTagging).success(function(data){ + $http.get(baseUrl + '/icons/' + $scope.selectedIcon.name + '/' + $scope.selectedIcon.name + '-' + svgVersion + '.svg').success(function(data){ var svgElement = angular.element(data); var innerSvgElement = null; From cf47cd66e586aee39279d3e418a8ee4d323349b0 Mon Sep 17 00:00:00 2001 From: Michiel Pater Date: Tue, 17 Aug 2021 01:11:46 +0200 Subject: [PATCH 3/5] Cache busting script.js as well, to load cache busting changes --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index ab77f7bab..e96b63e91 100644 --- a/docs/index.html +++ b/docs/index.html @@ -135,7 +135,7 @@

{{icon.name}}

- + - + +