Feature/rework vue schema
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
include 'JSShrink.php';
|
||||
|
||||
// Set the content type to JavaScript
|
||||
header('Content-Type: application/javascript');
|
||||
header('Cache-Control: max-age=31536000, public'); // Cache for 1 year
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); // Expires in 1 year
|
||||
|
||||
function combineAndMinifyJS($files) {
|
||||
$combinedContent = '';
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
$content = file_get_contents($file);
|
||||
// Minify using JSShrink
|
||||
$content = \JShrink\Minifier::minify($content);
|
||||
$combinedContent .= $content . "\n";
|
||||
} else {
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
echo "File not found: $file";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
return $combinedContent;
|
||||
}
|
||||
|
||||
$jsFiles = [
|
||||
"plugins/axios/axios.min.js",
|
||||
"plugins/moment/moment.min.js",
|
||||
"plugins/daterangepicker/daterangepicker.js",
|
||||
"plugins/vue/" . (isset($_GET['VUE_DEBUG']) || $_SERVER['HTTP_HOST'] === "localhost" ? "vue.js" : "vue.min.js"),
|
||||
"plugins/vue/tt-components/tt-table.js",
|
||||
"plugins/vue/tt-components/tt-page-title.js",
|
||||
"plugins/vue/tt-components/tt-loader.js",
|
||||
"plugins/vue/tt-components/tt-select.js",
|
||||
"plugins/vue/tt-components/tt-datepicker.js",
|
||||
"plugins/vue/tt-components/tt-input.js",
|
||||
"plugins/vue/tt-components/tt-autocomplete.js",
|
||||
"plugins/vue/tt-components/tt-icon-select.js",
|
||||
"plugins/vue/tt-components/tt-number-range.js",
|
||||
];
|
||||
|
||||
|
||||
// Output the combined and minified JavaScript
|
||||
$minified = combineAndMinifyJS($jsFiles);
|
||||
echo $minified;
|
||||
?>
|
||||
Reference in New Issue
Block a user