Permalink
Browse files

implement grunt-cache-breaker

  • Loading branch information...
stdavis committed Mar 12, 2018
1 parent 078745d commit c396cca4f7fc906fd5f965888c0a992b5ae0b9df
Showing with 102 additions and 13 deletions.
  1. +23 −5 GruntFile.js
  2. +1 −0 package.json
  3. +3 −1 src/EmbeddedMapLoader.js
  4. +17 −7 src/web.config
  5. +58 −0 yarn.lock
@@ -33,7 +33,7 @@ module.exports = function (grunt) {
var replaceCommonPatterns = [{
match: /\/\/ start replace[\w\W]*\/\/ end replace/,
replacement: 'document.write(\'<script type=\\\'text/javascript\\\' ' +
'src=\\\'\' + window.AGRC_server + \'/dojo/dojo.js\\\'' +
'src=\\\'\' + window.AGRC_server + dojoPath + \'\\\' ' +
'data-dojo-config="deps:[\\\'app/run\\\']"></script>\');'
},{
match: /bootstrap\/dist\/css/,
@@ -64,6 +64,20 @@ module.exports = function (grunt) {
push: false
}
},
cachebreaker: {
main: {
options: {
match: [
'dojo.js',
'app/resources/App.css',
'bootstrap/css/bootstrap.css'
]
},
files: {
src: ['dist/EmbeddedMapLoader.js']
}
}
},
clean: {
build: ['dist'],
deploy: ['deploy']
@@ -86,8 +100,10 @@ module.exports = function (grunt) {
},
copy: {
main: {
src: 'src/ChangeLog.html',
dest: 'dist/ChangeLog.html'
expand: true,
cwd: 'src/',
src: ['ChangeLog.html', 'web.config'],
dest: 'dist/'
}
},
dojo: {
@@ -256,7 +272,8 @@ module.exports = function (grunt) {
'dojo:prod',
'copy',
'processhtml:prod',
'replace:prod'
'replace:prod',
'cachebreaker'
]);
grunt.registerTask('deploy-prod', [
'clean:deploy',
@@ -271,7 +288,8 @@ module.exports = function (grunt) {
'dojo:stage',
'copy',
'processhtml:stage',
'replace:stage'
'replace:stage',
'cachebreaker'
]);
grunt.registerTask('deploy-stage', [
'clean:deploy',
@@ -4,6 +4,7 @@
"devDependencies": {
"grunt": "^1.0.1",
"grunt-bump": "^0.8.0",
"grunt-cache-breaker": "^2.0.1",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-compress": "^1.3.0",
"grunt-contrib-connect": "^1.0.2",
@@ -23,9 +23,11 @@
loadCss(window.AGRC_server + '/app/resources/App.css');
loadCss(window.AGRC_server + '/bootstrap/dist/css/bootstrap.css');
var dojoPath = '/dojo/dojo.js';
// start replace
document.write('<script type=\'text/javascript\' src=\'' +
window.AGRC_server + '/dojo/dojo.js\' data-dojo-config=\'isDebug: 1\'></script>');
window.AGRC_server + dojoPath + '\' data-dojo-config=\'isDebug: 1\'></script>');
document.write('<script type=\'text/javascript\' src=\'' +
window.AGRC_server + '/app/run.js\'></script>');
// end replace
@@ -1,10 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
<location path="EmbeddedMapLoader.js">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<httpProtocol allowKeepAlive="false">
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit c396cca

Please sign in to comment.