Commit a57586a2 authored by Danny Liu's avatar Danny Liu
Browse files

use IIFE in app.html to prevent FOUC

parent 41cb6d7a
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
<script> <script>
// On page load or when changing themes, best to add inline in `head` to avoid FOUC // On page load or when changing themes, best to add inline in `head` to avoid FOUC
(() => {
if ( if (
localStorage.theme === 'light' || localStorage.theme === 'light' ||
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: light)').matches) (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: light)').matches)
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
} }
} }
}); });
})();
</script> </script>
%sveltekit.head% %sveltekit.head%
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment