chore(deps): upgrade tailwind to v4 via vite plugin
Replace @astrojs/tailwind with @tailwindcss/vite in the Astro config and lockfile to adopt Tailwind CSS v4 and simplify the build setup. Also update Markdown site content with current SpaghetAI/MarvinBlade infrastructure details.
This commit is contained in:
1 parent
ac545c4668
commit
3fef5d378e
26 files changed
+1822
-3548
No files matched your search
+14
-15
@@ -1,9 +1,10 @@
|
||||
function changeTheme() {
|
||||
const element = document.documentElement
|
||||
const theme = element.classList.contains("dark") ? "light" : "dark"
|
||||
|
||||
console.log("Changing theme to:", theme)
|
||||
|
||||
const css = document.createElement("style")
|
||||
|
||||
|
||||
css.appendChild(
|
||||
document.createTextNode(
|
||||
`* {
|
||||
@@ -16,13 +17,15 @@ function changeTheme() {
|
||||
),
|
||||
)
|
||||
document.head.appendChild(css)
|
||||
|
||||
|
||||
if (theme === "dark") {
|
||||
element.classList.add("dark")
|
||||
} else {
|
||||
element.classList.remove("dark")
|
||||
}
|
||||
|
||||
|
||||
console.log("Dark class present:", element.classList.contains("dark"))
|
||||
|
||||
window.getComputedStyle(css).opacity
|
||||
document.head.removeChild(css)
|
||||
localStorage.theme = theme
|
||||
@@ -50,17 +53,13 @@ function preloadTheme() {
|
||||
localStorage.theme = theme
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
function initializeThemeButtons() {
|
||||
const headerThemeButton = document.getElementById("header-theme-button")
|
||||
const drawerThemeButton = document.getElementById("drawer-theme-button")
|
||||
headerThemeButton?.addEventListener("click", changeTheme)
|
||||
drawerThemeButton?.addEventListener("click", changeTheme)
|
||||
}
|
||||
|
||||
document.addEventListener("astro:after-swap", initializeThemeButtons)
|
||||
initializeThemeButtons()
|
||||
}
|
||||
// Use event delegation to avoid duplicate listeners on navigation
|
||||
document.addEventListener("click", (event) => {
|
||||
const target = event.target.closest("#header-theme-button, #drawer-theme-button");
|
||||
if (target) {
|
||||
changeTheme();
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("astro:after-swap", preloadTheme)
|
||||
|
||||
|
||||
Reference in new issue
Block a user