mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-30 04:25:57 -04:00
shift asset processing to webpack (#424)
also migrated SASS to latest syntax (via dart-sass) and vastly simplified light/dark theme logic
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
{{ $js := resources.Get "js/index.js" | js.Build (dict "targetPath" "/js/app.js") | resources.Babel (dict "config" "babel.config.json" "noComments" true) }}
|
||||
|
||||
{{- .Scratch.Set "bundlePermalink" $js.Permalink -}}
|
||||
|
||||
{{- define "__preload_js" -}}
|
||||
<link rel="preload" href="{{ $.Scratch.Get "bundlePermalink" }}" as="script">
|
||||
{{- end -}}
|
||||
|
||||
{{- define "__body_js" -}}
|
||||
<!-- inline the dark mode script to avoid a blinding flash of white background on loads -->
|
||||
<script>(function(d){var u=d.document,f=u.body.classList,e=localStorage,c="dark_mode_pref",t=e.getItem(c),a="dark",n="light",r="{{ .Site.Params.Theme.defaultTheme | safeJS }}",o=u.querySelector(".dark-mode-toggle"),i=r===a,b=function(d){f.remove(a,n);f.add(d);i=d===a};t===a&&b(a);t===n&&b(n);if(!t){var s=function(d){return"(prefers-color-scheme: "+d+")"};d.matchMedia(s(a)).matches?b(a):d.matchMedia(s(n)).matches?b(n):b(r);d.matchMedia(s(a)).addListener((function(d){d.matches&&b(a)}));d.matchMedia(s(n)).addListener((function(d){d.matches&&b(n)}))}if(o){o.style.display="block";o.addEventListener("click",(function(){if(i){b(n);e.setItem(c,n)}else{b(a);e.setItem(c,a)}}),!0)}})(window)</script>
|
||||
<script async defer src="{{ $.Scratch.Get "bundlePermalink" }}"></script>
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user