Commit 3440240e by kevalbhatt

ATLAS-2090 : UI - Cache busting for static content (css, js)

parent 979200e7
...@@ -23,8 +23,8 @@ module.exports = function(grunt) { ...@@ -23,8 +23,8 @@ module.exports = function(grunt) {
var classPathSep = (process.platform === "win32") ? ';' : ':', var classPathSep = (process.platform === "win32") ? ';' : ':',
gitHash = '', gitHash = '',
pkg = grunt.file.readJSON('package.json'), pkg = grunt.file.readJSON('package.json'),
buildTime = new Date().getTime(),
distPath = 'dist', distPath = 'dist',
publicPath = 'public',
libPath = distPath + '/js/libs', libPath = distPath + '/js/libs',
isDashboardDirectory = grunt.file.isDir('public'), isDashboardDirectory = grunt.file.isDir('public'),
modulesPath = 'public/'; modulesPath = 'public/';
...@@ -259,6 +259,18 @@ module.exports = function(grunt) { ...@@ -259,6 +259,18 @@ module.exports = function(grunt) {
dest: 'dist/js/templates' dest: 'dist/js/templates'
}] }]
} }
},
template: {
build: {
options: {
data: {
'bust': buildTime
}
},
files: {
[distPath + '/index.html']: [modulesPath + '/index.html.tpl']
}
}
} }
}); });
...@@ -269,6 +281,7 @@ module.exports = function(grunt) { ...@@ -269,6 +281,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-htmlmin'); grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-template');
require('load-grunt-tasks')(grunt); require('load-grunt-tasks')(grunt);
...@@ -287,6 +300,7 @@ module.exports = function(grunt) { ...@@ -287,6 +300,7 @@ module.exports = function(grunt) {
'npmcopy:license', 'npmcopy:license',
'copy:dist', 'copy:dist',
'sass:dist', 'sass:dist',
'template',
'configureProxies:server', 'configureProxies:server',
'connect:server', 'connect:server',
'watch' 'watch'
...@@ -298,7 +312,8 @@ module.exports = function(grunt) { ...@@ -298,7 +312,8 @@ module.exports = function(grunt) {
'npmcopy:css', 'npmcopy:css',
'npmcopy:license', 'npmcopy:license',
'copy:build', 'copy:build',
'sass:build' 'sass:build',
'template'
]); ]);
grunt.registerTask('dev-minify', [ grunt.registerTask('dev-minify', [
...@@ -310,6 +325,7 @@ module.exports = function(grunt) { ...@@ -310,6 +325,7 @@ module.exports = function(grunt) {
'sass:dist', 'sass:dist',
'uglify:build', 'uglify:build',
'cssmin:build', 'cssmin:build',
'template',
'configureProxies:server', 'configureProxies:server',
'connect:server', 'connect:server',
'watch' 'watch'
...@@ -323,6 +339,7 @@ module.exports = function(grunt) { ...@@ -323,6 +339,7 @@ module.exports = function(grunt) {
'copy:build', 'copy:build',
'sass:build', 'sass:build',
'uglify:build', 'uglify:build',
'cssmin:build' 'cssmin:build',
'template'
]); ]);
}; };
\ No newline at end of file
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
"grunt-npmcopy": "^0.1.0", "grunt-npmcopy": "^0.1.0",
"grunt-sass": "^1.1.0", "grunt-sass": "^1.1.0",
"grunt-shell": "^1.1.1", "grunt-shell": "^1.1.1",
"grunt-template": "^1.0.0",
"load-grunt-tasks": "^3.1.0", "load-grunt-tasks": "^3.1.0",
"proxit": "~0.6.4" "proxit": "~0.6.4"
} }
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 7]> <!--[if gt IE 7]>
<script src="js/external_lib/es5-shim.min.js"></script> <script src="js/external_lib/es5-shim.min.js?bust=<%- bust %>"></script>
<script src="js/external_lib/respond.min.js"></script> <script src="js/external_lib/respond.min.js?bust=<%- bust %>"></script>
<![endif]--> <![endif]-->
<!--[if gt IE 8]><!--> <!--[if gt IE 8]><!-->
<html class="no-js"> <html class="no-js">
...@@ -29,32 +29,32 @@ ...@@ -29,32 +29,32 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8; Cache-Control: no-cache" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8;" />
<title>Atlas</title> <title>Atlas</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="favicon.ico?bust=<%- bust %>" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="icon" href="favicon.ico?bust=<%- bust %>" type="image/x-icon">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" type="text/css" href="css/animate.min.css" /> <link rel="stylesheet" type="text/css" href="css/animate.min.css?bust=<%- bust %>" />
<link rel="stylesheet" href="js/libs/backgrid/css/backgrid.css"> <link rel="stylesheet" href="js/libs/backgrid/css/backgrid.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/backgrid-filter/css/backgrid-filter.min.css"> <link rel="stylesheet" href="js/libs/backgrid-filter/css/backgrid-filter.min.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/backgrid-paginator/css/backgrid-paginator.css"> <link rel="stylesheet" href="js/libs/backgrid-paginator/css/backgrid-paginator.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/backgrid-orderable-columns/css/backgrid-orderable-columns.css"> <link rel="stylesheet" href="js/libs/backgrid-orderable-columns/css/backgrid-orderable-columns.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/backgrid-sizeable-columns/css/backgrid-sizeable-columns.css"> <link rel="stylesheet" href="js/libs/backgrid-sizeable-columns/css/backgrid-sizeable-columns.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/backgrid-columnmanager/css/Backgrid.ColumnManager.css"> <link rel="stylesheet" href="js/libs/backgrid-columnmanager/css/Backgrid.ColumnManager.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/select2/css/select2.min.css"> <link rel="stylesheet" href="js/libs/select2/css/select2.min.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="js/libs/bootstrap/css/bootstrap.min.css?bust=<%- bust %>">
<link rel="stylesheet" href="js/libs/jquery-asBreadcrumbs/css/asBreadcrumbs.min.css"> <link rel="stylesheet" href="js/libs/jquery-asBreadcrumbs/css/asBreadcrumbs.min.css?bust=<%- bust %>">
<link rel="stylesheet" href="css/googlefonts.css" type='text/css'> <link rel="stylesheet" href="css/googlefonts.css?bust=<%- bust %>" type='text/css'>
<link rel="stylesheet" type="text/css" href="js/external_lib/jquery-ui/jquery-ui.min.css"> <link rel="stylesheet" type="text/css" href="js/external_lib/jquery-ui/jquery-ui.min.css?bust=<%- bust %>">
<link href="css/bootstrap-sidebar.css" rel="stylesheet"> <link href="css/bootstrap-sidebar.css?bust=<%- bust %>" rel="stylesheet">
<link href="js/libs/font-awesome/css/font-awesome.min.css" rel="stylesheet"> <link href="js/libs/font-awesome/css/font-awesome.min.css?bust=<%- bust %>" rel="stylesheet">
<link href="js/external_lib/pnotify/pnotify.custom.min.css" rel="stylesheet"> <link href="js/external_lib/pnotify/pnotify.custom.min.css?bust=<%- bust %>" rel="stylesheet">
<link href="js/libs/jQueryQueryBuilder/css/query-builder.default.min.css" rel="stylesheet"> <link href="js/libs/jQueryQueryBuilder/css/query-builder.default.min.css?bust=<%- bust %>" rel="stylesheet">
<link href="js/libs/bootstrap-daterangepicker/css/daterangepicker.css" rel="stylesheet"> <link href="js/libs/bootstrap-daterangepicker/css/daterangepicker.css?bust=<%- bust %>" rel="stylesheet">
<link rel="stylesheet" href="js/libs/nvd3/css/nv.d3.min.css"> <link rel="stylesheet" href="js/libs/nvd3/css/nv.d3.min.css?bust=<%- bust %>">
<link href="css/style.css" rel="stylesheet"> <link href="css/style.css?bust=<%- bust %>" rel="stylesheet">
</head> </head>
<body> <body>
...@@ -72,8 +72,13 @@ ...@@ -72,8 +72,13 @@
</div> </div>
</div> </div>
<!-- build:js scripts/main.js --> <!-- build:js scripts/main.js -->
<script data-main="js/main" src="js/libs/requirejs/require.js"></script> <script data-main="js/main.js?bust=<%- bust %>" src="js/libs/requirejs/require.js?bust=<%- bust %>"></script>
<!-- endbuild --> <!-- endbuild -->
<script type="text/javascript">
var getBustValue = function() {
return '<%- bust %>'
}
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -27,6 +27,7 @@ require.config({ ...@@ -27,6 +27,7 @@ require.config({
'templateExtension': 'html', // Set the extension automatically appended to templates 'templateExtension': 'html', // Set the extension automatically appended to templates
'compileOptions': {} // options object which is passed to Handlebars compiler 'compileOptions': {} // options object which is passed to Handlebars compiler
}, },
'urlArgs': "bust=" + getBustValue(),
/** /**
* Requested as soon as the loader has processed the configuration. It does * Requested as soon as the loader has processed the configuration. It does
* not block any other require() calls from starting their requests for * not block any other require() calls from starting their requests for
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment