Skip to content

Commit

Permalink
caching and defer non module scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderGi committed Apr 16, 2024
1 parent 2c95d4e commit cdc4b15
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 63 deletions.
31 changes: 30 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
{
"hosting": {
"public": "public",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"headers": [
{
"source": "**/*.@(js|css|html)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=3600"
}
]
},
{
"source": "**/lib/**",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=604800"
}
]
},
{
"source": "**/*.@(jpg|jpeg|gif|png)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=604800"
}
]
}
]
}
}
8 changes: 4 additions & 4 deletions public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Custom Components -->
<script type="module" src="/components/Navigation.js"></script>
<script type="module" src="/components/MessageContainer.js"></script>
<script type="module" src="./components/Navigation.js"></script>
<script type="module" src="./components/MessageContainer.js"></script>
</head>
<body>
<navigation-manager>
Expand Down
21 changes: 15 additions & 6 deletions public/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,26 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- Import the webpage's stylesheet -->
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Import QR Code creating -->
<script src="lib/qrcode.min.js"></script>
<!-- Import QR Code creation -->
<script src="./lib/qrcode.min.js" defer></script>

<!-- Custom Components -->
<script type="module" src="components/Navigation.js"></script>
<script type="module" src="components/ContactForm.js"></script>
<script type="module" src="./components/Navigation.js"></script>
<script type="module" src="./components/ContactForm.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
<link rel="preconnect" href="https://cdnjs.cloudflare.com" />
<link rel="preconnect" href="https://www.gstatic.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" />

<style>
/* smooth load */
Expand Down
8 changes: 4 additions & 4 deletions public/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Import QR generating capabilities -->
<script src="lib/qrcode.min.js"></script>
<script src="./lib/qrcode.min.js" defer></script>

<!-- Custom Components -->
<script type="module" src="./components/Navigation.js"></script>
<script type="module" src="./components/TypeSelect.js"></script>
<script type="module" src="./components/DataTable.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand Down
16 changes: 8 additions & 8 deletions public/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="./style.css" />
<!-- Add the evo-calendar.css for styling -->
<link rel="stylesheet" type="text/css" href="/lib/evo-calendar.min.css" />
<link rel="stylesheet" type="text/css" href="./lib/evo-calendar.min.css" />

<!-- Custom Components -->
<script type="module" src="/components/Navigation.js"></script>
<script type="module" src="./components/Navigation.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand All @@ -40,10 +40,10 @@
<navigation-manager>
<div id="calendar" style="min-height: 100%"></div>
</navigation-manager>
<script src="/lib/jquery.min.js"></script>
<script src="./lib/jquery.min.js"></script>
<!-- jQuery is required for evo-calendar -->
<script src="/lib/evo-calendar.min.js"></script>
<script type="module" src="/calendar.js"></script>
<script src="./lib/evo-calendar.min.js"></script>
<script type="module" src="./calendar.js"></script>
<noscript>
Please enable JavaScript for full functionality.
<!-- smooth load -->
Expand Down
16 changes: 8 additions & 8 deletions public/groups.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- Import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Import QR scanning capabilities -->
<script defer src="lib/html5_qrcode.min.js"></script>
<script src="./lib/html5_qrcode.min.js" defer></script>

<!-- Charts -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js" defer></script>

<!-- Custom Components -->
<script type="module" src="components/Navigation.js"></script>
<script type="module" src="./components/Navigation.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand All @@ -40,7 +40,7 @@
<navigation-manager>
<section class="light-section" style="min-height: 65%">
<h1>My Groups</h1>
<a href="/payment.html" class="button">Manage Groups</a>
<a href="./payment.html" class="button">Manage Groups</a>
<button class="button" id="join">Scan QR Code to Join</button>
<div class="qr-container">
<div id="qr-reader" class="buttonize"></div>
Expand All @@ -50,7 +50,7 @@ <h1>My Groups</h1>
</section>
</navigation-manager>

<script type="module" src="/groups.js"></script>
<script type="module" src="./groups.js"></script>
<noscript>
Please enable JavaScript for full functionality.
<!-- smooth load -->
Expand Down
14 changes: 7 additions & 7 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- Import the webpage's stylesheet -->
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Import QR Code creating -->
<script src="lib/qrcode.min.js"></script>
<script src="lib/qrcode.min.js" defer></script>

<!-- Custom Components -->
<script type="module" src="components/Navigation.js"></script>
<script type="module" src="components/ContactForm.js"></script>
<script type="module" src="components/Action.js"></script>
<script type="module" src="./components/Navigation.js"></script>
<script type="module" src="./components/ContactForm.js"></script>
<script type="module" src="./components/Action.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand Down
14 changes: 7 additions & 7 deletions public/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- import the webpage's stylesheet -->
<link type="text/css" rel="stylesheet" href="/style.css" />
<link type="text/css" rel="stylesheet" href="./style.css" />

<!-- Custom Components -->
<script type="module" src="/components/Navigation.js"></script>
<script type="module" src="/components/CircleLoader.js"></script>
<script type="module" src="/components/MessageContainer.js"></script>
<script type="module" src="./components/Navigation.js"></script>
<script type="module" src="./components/CircleLoader.js"></script>
<script type="module" src="./components/MessageContainer.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand All @@ -39,6 +39,6 @@ <h1>Click below to sign in:</h1>

<circle-loader id="loader"></circle-loader>

<script type="module" src="/login.js"></script>
<script type="module" src="./login.js"></script>
</body>
</html>
18 changes: 9 additions & 9 deletions public/payment.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Payment with Braintree -->
<script src="https://js.braintreegateway.com/web/dropin/1.33.7/js/dropin.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.88.6/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.88.6/js/data-collector.min.js"></script>
<script src="https://js.braintreegateway.com/web/dropin/1.33.7/js/dropin.min.js" defer></script>
<script src="https://js.braintreegateway.com/web/3.88.6/js/client.min.js" defer></script>
<script src="https://js.braintreegateway.com/web/3.88.6/js/data-collector.min.js" defer></script>

<!-- Custom Components -->
<script type="module" src="/components/Navigation.js"></script>
<script type="module" src="/components/CircleLoader.js"></script>
<script type="module" src="./components/Navigation.js"></script>
<script type="module" src="./components/CircleLoader.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand Down Expand Up @@ -96,6 +96,6 @@ <h2>Purchase Subscription</h2>

<circle-loader id="loader"></circle-loader>

<script type="module" src="/payment.js"></script>
<script type="module" src="./payment.js"></script>
</body>
</html>
8 changes: 4 additions & 4 deletions public/scanner.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- Import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />

<!-- Import QR scanning capabilities -->
<script src="lib/html5_qrcode.min.js"></script>
<script src="lib/html5_qrcode.min.js" defer></script>

<!-- Import QR generating -->
<script src="lib/qrcode.min.js"></script>
<script src="lib/qrcode.min.js" defer></script>

<!-- Custom Components -->
<script type="module" src="/components/Navigation.js"></script>
Expand Down Expand Up @@ -62,6 +62,6 @@ <h1>Scan QR Codes to Take Attendance</h1>
</section>
</navigation-manager>

<script type="module" src="/scanner.js" defer></script>
<script type="module" src="./scanner.js" defer></script>
</body>
</html>
10 changes: 5 additions & 5 deletions public/userAttendance.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" href="/assets/logo.png" />
<link rel="icon" type="image/png" href="./assets/logo.png" />

<!-- Import the webpage's stylesheet -->
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="./style.css" />

<!-- Custom Components -->
<script type="module" src="/components/Navigation.js"></script>
<script type="module" src="./components/Navigation.js"></script>

<!-- Prefetch -->
<link rel="prefetch" href="/assets/logo.png" />
<link rel="prefetch" href="./assets/logo.png" />
<link rel="preconnect" href="https://attendancescannerqr.firebaseapp.com" />
<link rel="preconnect" href="https://attendqr.fly.dev" />
<link rel="preconnect" href="https://identitytoolkit.googleapis.com" />
Expand All @@ -32,7 +32,7 @@
</section>
</navigation-manager>

<script type="module" defer>
<script type="module">
import { POST } from './util/Client.js';
import { requireLogin, getCurrentUser } from './util/Auth.js';
import { useURL } from './util/StateManager.js';
Expand Down

0 comments on commit cdc4b15

Please sign in to comment.