1
0
mirror of https://github.com/konpa/devicon.git synced 2025-04-21 13:21:56 +02:00

Feature/website cache busting (#813)

* Feature: Cache busting website data (JavaScript and SVG files) by adding '?version' to these filenames

* Updated script.js to use CDN versioning style

* Cache busting script.js as well, to load cache busting changes

* Website cache busting fix

* Cache busting script.js using Date.now()

Co-authored-by: Thomas Bui <43018778+Thomas-Boi@users.noreply.github.com>
This commit is contained in:
M Pater 2021-08-23 21:11:32 +02:00 committed by GitHub
parent 0c061e1562
commit 92417d491b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -24,11 +24,11 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) {
console.log('Unable to determine latest release version, fallback to master.')
});
var baseUrl = `https://cdn.jsdelivr.net/gh/${gitHubPath}/`
var versionStr = '@' + $scope.latestReleaseTagging;
var baseUrl = `https://cdn.jsdelivr.net/gh/${gitHubPath}${versionStr}/`
// Get devicon.json
$http.get(baseUrl + '/devicon.json').success(function(data) {
$http.get(baseUrl + 'devicon.json').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').success(function(data){
var svgElement = angular.element(data);
var innerSvgElement = null;

View File

@ -135,7 +135,10 @@
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular-sanitize.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular-animate.min.js"></script>
<script src="assets/js/script.js"></script>
<script>
document.write("<script src='assets/js/script.js?" + Date.now() + "'><\/script>");
</script>
<script>
(function(i, s, o, g, r, a, m) {