[TASK] Add cache breaker as variable and scss

This commit is contained in:
Xaver Maierhofer 2017-02-01 22:41:29 +01:00
parent 7d7fc1ac5a
commit 3c5044f137
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8
6 changed files with 26 additions and 6 deletions

View File

@ -5,3 +5,5 @@ rules:
no-vendor-prefixes: 0
# Needed for old 'display: -vendor-prefix-property' for higher browser-support
no-duplicate-properties: 0
# Needed for unique-id()
empty-args: 0

View File

@ -261,6 +261,12 @@ Example for `supportedLocale`:
"en",
"de"
]
## cacheBreaker (string)
Will be replaced in every build to avoid missing or outdated language strings, because language.json isn't up to date.
_Fixed value (y0z)._
## Sponsoring / Supporting
- [BrowserStack](https://www.browserstack.com/) for providing a awesome testing service for hundreds of browsers

View File

@ -1,13 +1,15 @@
// Needed for standalone scss
// @import 'icon-mixin';
$cache-breaker: unique-id();
@font-face {
font-family: 'ionicons';
font-style: normal;
font-weight: normal;
src: url('fonts/icon.woff2') format('woff2'),
url('fonts/icon.woff') format('woff'),
url('fonts/icon.ttf') format('truetype');
src: url('fonts/icon.woff2?rel=#{$cache-breaker}') format('woff2'),
url('fonts/icon.woff?rel=#{$cache-breaker}') format('woff'),
url('fonts/icon.ttf?rel=#{$cache-breaker}') format('truetype');
}
[class^='ion-'], [class*=' ion-'] {

View File

@ -114,5 +114,6 @@
"supportedLocale": [
"en",
"de"
]
],
"cacheBreaker": "y0z"
}

View File

@ -178,7 +178,7 @@ define(['polyglot', 'moment', 'router', 'leaflet', 'gui', 'helper'],
});
window._ = new Polyglot({locale: locale, allowMissing: true});
helper.getJSON('locale/' + _.locale() + '.json').then(setTranslation);
helper.getJSON('locale/' + _.locale() + '.json?' + config.cacheBreaker).then(setTranslation);
var router = new Router();

View File

@ -149,13 +149,22 @@ module.exports = function exports(grunt) {
}
},
cachebreaker: {
default: {
js: {
options: {
match: ['app.js']
},
files: {
src: ['build/index.html']
}
},
variable: {
options: {
match: ['y*z'],
position: 'overwrite'
},
files: {
src: ['build/config.json']
}
}
}
});