Skip to content

Commit e5227c3

Browse files
committed
(#1013) Add Hash to CSS and JS files
This adds the commit hash to the CSS and JS files to ensure that the browser always fetches the latest version of the files when it is updated. This sometimes becomes a problem when the CSS and JS files are cached, doing this will ensure that these files are updated along with the content.
1 parent 63261b6 commit e5227c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/layouts/Layout.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ const hash = childProcess
8484
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Roboto+Mono:wght@300;400;600;700&display=swap" rel="stylesheet">
8585

8686
<!-- CSS -->
87-
<link rel="stylesheet" href="/styles/docs.min.purged.css" />
87+
<link rel="stylesheet" href={`/styles/docs.min.purged.css?v=${hash}`} />
8888

8989
<!-- JS -->
90-
<script is:inline src="/scripts/theme-toggle.min.js"></script>
90+
<script is:inline src={`/scripts/theme-toggle.min.js?v=${hash}`}></script>
9191
<script is:inline async referrerpolicy="unsafe-url" src="https://ws.zoominfo.com/pixel/KPKpTJOFOv5SuV7X3eGx"></script>
9292
<title>{metaTitle}</title>
9393
</head>
@@ -134,6 +134,6 @@ const hash = childProcess
134134
<button type="button" class="btn btn-bg-body d-md-none" data-bs-dismiss="alert" aria-label="Close">I accept</button>
135135
</div>
136136
</footer>
137-
<script is:inline src="/scripts/docs.min.js"></script>
137+
<script is:inline src={`/scripts/docs.min.js?v=${hash}`}></script>
138138
</body>
139139
</html>

0 commit comments

Comments
 (0)