Skip to content

Commit c020a34

Browse files
committed
feat: add runtime minifier
If "debug" is set to false in the index, the minifier script will minify the css and js code and insert it into the HTML page when it's requested (yey).
1 parent c840e09 commit c020a34

12 files changed

+121
-89
lines changed

index.php

+26-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<!DOCTYPE html>
2+
3+
<?php
4+
5+
require_once("utils/minifier.php");
6+
7+
// Set to false to enable the miinified versions of JS and CSS files
8+
// that should speed up content delivery on production websites
9+
$debug = true;
10+
?>
11+
212
<html>
313
<head>
414
<meta charset="utf-8">
5-
<title>Live map</title>
15+
<title>Havoc's Live map</title>
616

717
<link href="https://identityrp.co.uk/assets/favicon-79hd8bjv.png" rel="shortcut icon">
818

@@ -30,8 +40,11 @@
3040
</style>
3141

3242
<link type="text/css" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
33-
<link type="text/css" rel="stylesheet" href="style/bootstrap.min.css">
34-
<link type="text/css" rel="stylesheet" href="style/style.css">
43+
<?php
44+
45+
printCss($debug);
46+
47+
?>
3548

3649
<script src="js/jquery-3.2.1.min.js"></script>
3750

@@ -63,27 +76,14 @@
6376

6477
// Set to the IP of the GTA server running "live_map" and change the port to the
6578
// number that is in the "server.lua" file
66-
var _SETTINGS_socketUrl = "wss://identityrp.co.uk:30121"
79+
var _SETTINGS_socketUrl = "ws://localhost:30121"
6780

6881
</script>
6982

70-
<!-- IF DEBUG. Use un-minified version -->
71-
<!--
72-
<script type="text/javascript" src="js/src/init.js"></script>
73-
<script type="text/javascript" src="js/src/markers.js"></script>
74-
<script type="text/javascript" src="js/src/objects.js"></script>
75-
<script type="text/javascript" src="js/src/utils.js"></script>
76-
<script type="text/javascript" src="js/src/map.js"></script>
77-
<script type="text/javascript" src="js/src/socket.js"></script>
78-
-->
79-
<!-- IF PRODUCTION. Use minified version -->
80-
81-
<script type="text/javascript" src="js/init.min.js"></script>
82-
<script type="text/javascript" src="js/markers.min.js"></script>
83-
<script type="text/javascript" src="js/objects.min.js"></script>
84-
<script type="text/javascript" src="js/utils.min.js"></script>
85-
<script type="text/javascript" src="js/map.min.js"></script>
86-
<script type="text/javascript" src="js/socket.min.js"></script>
83+
84+
<?php
85+
printFirstJs($debug);
86+
?>
8787

8888
<script>
8989
function startMarkers(){
@@ -158,7 +158,11 @@ function startMarkers(){
158158
<p style="color: black; text-align: center;">This was originaly created for <a href="https://identityrp.co.uk">IdentityRP</a></p>
159159
</div>
160160
</div>
161-
<script src="js/controls.min.js"></script>
161+
162+
<?php
163+
printLastJs($debug);
164+
?>
165+
162166
</body>
163167

164168
</html>

js/controls.min.js

-4
This file was deleted.

js/init.min.js

-1
This file was deleted.

js/map.min.js

-37
This file was deleted.

js/markers.min.js

-2
This file was deleted.

js/objects.min.js

-3
This file was deleted.

js/socket.min.js

-14
This file was deleted.

js/utils.min.js

-6
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)