summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-05-04 00:58:50 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 16:44:10 +0200
commitc897aa84567ba046644a87e23b32f3df4c5845d3 (patch)
tree0f98f9b4475e485e86e9fd666cc295e9fb7bcd04 /application
parent0cbb8802555ad6e81f42ce8738842854d0556296 (diff)
Set cache buster for js with urlArgs setting
No more need for timestamp in filename of minified main js
Diffstat (limited to 'application')
-rw-r--r--application/helpers/filebin_helper.php7
-rw-r--r--application/views/header.php3
2 files changed, 5 insertions, 5 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php
index 8db605cfd..7adab7279 100644
--- a/application/helpers/filebin_helper.php
+++ b/application/helpers/filebin_helper.php
@@ -135,11 +135,10 @@ function link_with_mtime($file)
return $link;
}
-function main_min_js_name()
+function js_cache_buster()
{
- $files = glob(FCPATH . 'data/js/main.min.*.js');
- $filename = basename(empty($files) ? 'MAIN_NOT_MINIFIED' : end($files));
- return str_replace('.js', '', $filename);
+ $minified_main = FCPATH.'/data/js/main.min.js';
+ return file_exists($minified_main) ? filemtime($minified_main) : time();
}
function handle_etag($etag)
diff --git a/application/views/header.php b/application/views/header.php
index f80ffed05..6e7ef3a92 100644
--- a/application/views/header.php
+++ b/application/views/header.php
@@ -32,8 +32,9 @@ if (is_cli_client() && !isset($force_full_html)) {
window.appConfig = {};
require.config({
baseUrl: '/data/js',
+ urlArgs: '<?php echo js_cache_buster(); ?>',
paths: {
- 'main': ['<?php echo main_min_js_name(); ?>', 'main']
+ 'main': ['main.min', 'main']
}
});
require(['main']);