Move minifying and bundling JS and CSS to compile.php, add header

Close #17
This commit is contained in:
2022-11-07 21:11:34 +01:00
parent 2e349568e7
commit 05d6865cb3
11 changed files with 236 additions and 114 deletions

View File

@ -53,6 +53,12 @@ function generateTranslationFile(string $lang):string {
'errors_controlledLists' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_controlledLists'),
'errors_mainImageResource' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'errors_mainImageResource'),
'allowed_values' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'allowed_values'),
'privacy_policy' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'privacy_policy'),
'contact' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'contact'),
'news' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'news'),
'imprint' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'imprint'),
'about' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'about'),
]);
}
@ -70,7 +76,7 @@ function generateAppShell():string {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css" />
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000001" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#aa4400" />
@ -93,7 +99,7 @@ function generateAppShell():string {
</head>
<body class="loading">
<script src="assets/js/csvxmlV2.min.js" type="text/javascript" async></script>
<script src="assets/js/csvxmlV2.min.js?v000001" type="text/javascript" async></script>
</body>
</html>';
@ -111,3 +117,13 @@ foreach (ALLOWED_LANGS as $lang) {
}
file_put_contents(SERVED_ROOT . 'index.htm', generateAppShell());
exec("minify \\
-o " . escapeshellarg(__DIR__ . '/../public/assets/css/csvxml.min.css') . '\\
' . escapeshellarg(__DIR__ . '/../public/assets/css/editMenu.css') . '\\
' . escapeshellarg(__DIR__ . '/../public/assets/css/dialogue.css') . '\\
' . escapeshellarg(__DIR__ . '/../public/assets/css/csvxml.css'));
exec("minify \\
-o " . escapeshellarg(__DIR__ . '/../public/assets/js/csvxmlV2.min.js') . '\
' . escapeshellarg(__DIR__ . '/../public/assets/js/csvxmlV2.js'));