mirror of
https://github.com/ivuorinen/homebrew-tap.git
synced 2026-02-26 16:54:39 +00:00
feat: full site
This commit is contained in:
31
theme/_head.html.erb
Normal file
31
theme/_head.html.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<% page_title = title.to_s %>
|
||||
<title><%= h(page_title) %></title>
|
||||
<% stylesheet = style_path || 'style.css' %>
|
||||
<link rel="stylesheet" href="<%= h(stylesheet) %>">
|
||||
<script src="https://cdn.tailwindcss.com?plugins=forms,typography"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: "class"
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
(function () {
|
||||
if (typeof window === "undefined") return;
|
||||
try {
|
||||
const stored = window.localStorage.getItem("theme");
|
||||
const prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
const theme = stored || (prefersDark ? "dark" : "light");
|
||||
document.documentElement.classList.toggle("dark", theme === "dark");
|
||||
document.documentElement.classList.toggle("light", theme !== "dark");
|
||||
document.documentElement.setAttribute("data-theme", theme);
|
||||
} catch (error) {
|
||||
document.documentElement.classList.toggle("dark", false);
|
||||
document.documentElement.classList.toggle("light", true);
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
Reference in New Issue
Block a user