Skip to content

Commit

Permalink
Remove Data Root and use Import Meta
Browse files Browse the repository at this point in the history
Switch dark mode to use import meta for root path. Remove the data root
property now that we no longer need it.
  • Loading branch information
iwillspeak committed Sep 11, 2022
1 parent af681b6 commit 061f03c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion assets/dark.js
@@ -1,7 +1,8 @@
const darkModePlaceholder = document.getElementById("dark-mode-placeholder");
const prefersDarkMode = window.matchMedia("(prefers-color-scheme: dark)");

const rootPath = document.body.dataset['root'];
const url = import.meta.url;
const rootPath = url.substring(0, url.lastIndexOf('/') + 1)

const sunIcon = `sun`
const moonIcon = `moon`
Expand Down
2 changes: 1 addition & 1 deletion src/render/layout/html.rs
Expand Up @@ -161,7 +161,7 @@ impl Layout for HtmlLayout {
<script src="{root}dark.js" type=module></script>
<script src="{root}search.js" type=module></script>
</head>
<body data-root="{root}">
<body>
<header class="site-head">
<div class="content">
<nav class="breadcrumbs">{breadcrumbs}</nav>
Expand Down

0 comments on commit 061f03c

Please sign in to comment.