mirror of
https://github.com/davegallant/davegallant.github.io.git
synced 2025-08-07 17:12:27 +00:00
Rename theme path
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
<!-- Styles -->
|
||||
{{ $defaultTheme := .Param "defaultTheme" | default "light" }}
|
||||
|
||||
{{ $critical := sort (resources.Match "css/critical/*.css") "Name" | resources.Concat nil | resources.ExecuteAsTemplate nil . | resources.PostCSS }}
|
||||
{{ $nonCritical := sort (resources.Match "css/non-critical/*.css") "Name" | resources.Concat "css/non-critical.css" | resources.ExecuteAsTemplate "css/non-critical.css" . | resources.PostCSS }}
|
||||
{{ $prismDark := resources.Get "prism-themes/prism-gruvbox-dark.css" }}
|
||||
{{ $prismLight := resources.Get "prism-themes/prism-gruvbox-light.css" }}
|
||||
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $critical = $critical | resources.PostProcess }}
|
||||
{{ $nonCritical = $nonCritical | fingerprint "sha512" | resources.PostProcess }}
|
||||
{{ $prismDark = $prismDark | minify | fingerprint "sha512" }}
|
||||
{{ $prismLight = $prismLight | minify | fingerprint "sha512" }}
|
||||
{{ end }}
|
||||
|
||||
<style>
|
||||
/* stylelint-disable */
|
||||
{{ $critical.Content | safeCSS }}
|
||||
/* stylelint-enable */
|
||||
</style>
|
||||
|
||||
<link
|
||||
rel="preload"
|
||||
href="{{ $nonCritical.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
/>
|
||||
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
id="prism-dark"
|
||||
rel="preload"
|
||||
href="{{ $prismDark.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
{{ if eq $defaultTheme "light" }}disabled{{ end }}
|
||||
/>
|
||||
|
||||
<!-- TODO Use prefetch when more widely supported -->
|
||||
<link
|
||||
id="prism-light"
|
||||
rel="preload"
|
||||
href="{{ $prismLight.RelPermalink }}"
|
||||
as="style"
|
||||
onload="this.onload=null;this.rel='stylesheet'"
|
||||
{{ if eq $defaultTheme "dark" }}disabled{{ end }}
|
||||
/>
|
||||
|
||||
<noscript>
|
||||
{{ if eq $defaultTheme "light" }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $prismLight.RelPermalink }}"
|
||||
/>
|
||||
{{ else }}
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $prismDark.RelPermalink }}"
|
||||
/>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ $nonCritical.RelPermalink }}"
|
||||
/>
|
||||
</noscript>
|
Reference in New Issue
Block a user