diff options
Diffstat (limited to 'application')
-rw-r--r-- | application/helpers/filebin_helper.php | 7 | ||||
-rw-r--r-- | application/views/header.php | 10 |
2 files changed, 15 insertions, 2 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 2ac061e79..8db605cfd 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -135,6 +135,13 @@ function link_with_mtime($file) return $link; } +function main_min_js_name() +{ + $files = glob(FCPATH . 'data/js/main.min.*.js'); + $filename = basename(empty($files) ? 'MAIN_NOT_MINIFIED' : end($files)); + return str_replace('.js', '', $filename); +} + function handle_etag($etag) { $etag = strtolower($etag); diff --git a/application/views/header.php b/application/views/header.php index 89a3c8617..f80ffed05 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -26,13 +26,19 @@ if (is_cli_client() && !isset($force_full_html)) { echo '<link href="'.link_with_mtime("/data/local/favicon.png").'" rel="shortcut icon">'; } ?> + <script src="<?php echo link_with_mtime("/data/js/vendor/require.js"); ?>"></script> <script type="text/javascript"> /* <![CDATA[ */ - var require = { baseUrl: '/data/js' }; window.appConfig = {}; + require.config({ + baseUrl: '/data/js', + paths: { + 'main': ['<?php echo main_min_js_name(); ?>', 'main'] + } + }); + require(['main']); /* ]]> */ </script> - <script data-main="main" src="/data/js/vendor/require.js"></script> </head> <body> |