MAPG-28 add static root and revision to the local JS and CSS files

This commit is contained in:
Bence Pőcze 2020-06-12 19:17:41 +02:00
parent 7690714b26
commit 08d4aec48e
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,13 @@
<?php if (isset($jsFiles)) : ?>
<?php foreach ($jsFiles as $jsFile) : ?>
<?php
if (!preg_match('/^http(s)?/', $jsFile)) {
$jsFile = $_ENV['STATIC_ROOT'] . '/' . $jsFile . '?rev=' . REVISION;
}
?>
<script src="<?= $jsFile ?>"></script>
<?php endforeach; ?>
<?php endif; ?>
<script> <script>
(function () { (function () {
var anchors = document.getElementsByTagName('a'); var anchors = document.getElementsByTagName('a');

View File

@ -4,9 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>MapGuesser</title> <title>MapGuesser</title>
<link href="/static/css/mapguesser.css" rel="stylesheet"> <link href="<?= $_ENV['STATIC_ROOT'] ?>/css/mapguesser.css?rev=<?= REVISION ?>" rel="stylesheet">
<?php if (isset($cssFiles)) : ?> <?php if (isset($cssFiles)) : ?>
<?php foreach ($cssFiles as $cssFile) : ?> <?php foreach ($cssFiles as $cssFile) : ?>
<?php
if (!preg_match('/^http(s)?/', $cssFile)) {
$cssFile = $_ENV['STATIC_ROOT'] . '/' . $cssFile . '?rev=' . REVISION;
}
?>
<link href="<?= $cssFile ?>" rel="stylesheet"> <link href="<?= $cssFile ?>" rel="stylesheet">
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>