mirror of
https://github.com/naoufalzerai/zerai.xyz.git
synced 2025-11-09 23:15:53 +00:00
81 lines
3.6 KiB
HTML
81 lines
3.6 KiB
HTML
{{- $style := "auto" -}}
|
|
{{- if and (isset site.Params "style") (ne site.Params.style "") -}}
|
|
{{- $style = site.Params.style | lower -}}
|
|
{{- end -}}
|
|
|
|
{{- $coreCSS := resources.Get "css/normalize.css" -}}
|
|
{{- $coreCSS = slice $coreCSS (resources.Get "css/style.css") | resources.Concat "css/tmp_normalize.css" -}}
|
|
{{- if ne $style "light" -}}
|
|
{{- $darkStyle := resources.Get "css/dark-style.css" -}}
|
|
{{- if $darkStyle -}}
|
|
{{- if eq $style "dark" -}}
|
|
{{- $coreCSS = slice $coreCSS $darkStyle | resources.Concat "css/tmp_style.css" -}}
|
|
{{- else -}}
|
|
{{- $darkStyleBegin := (print "@media (prefers-color-scheme: dark) {") | resources.FromString "css/tmp_style_dark_begin.css" -}}
|
|
{{- $darkStyleEnd := (print "}") | resources.FromString "css/tmp_style_dark_end.css" -}}
|
|
{{- $darkStyleCSS := slice $darkStyleBegin $darkStyle | resources.Concat "css/tmp_style_dark_.css" -}}
|
|
{{- $darkStyleCSS = slice $darkStyleCSS $darkStyleEnd | resources.Concat "css/tmp_style_dark.css" -}}
|
|
{{- $coreCSS = slice $coreCSS $darkStyleCSS | resources.Concat "css/tmp_style.css" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- $themePath := "" -}}
|
|
{{- $theme := "dracula" -}}
|
|
{{- with site.Params.syntax -}}
|
|
{{- $use := "none" -}}
|
|
{{- if and (isset . "use") (ne .use "") -}}{{- $use = .use | lower -}}{{- end -}}
|
|
{{- if and (isset . "theme") (ne .theme "") -}}{{- $theme = .theme | lower -}}{{- end -}}
|
|
|
|
{{- if eq $use "hljs" -}}
|
|
{{- $themePath = "css/hljs/" -}}
|
|
{{- else if eq $use "prismjs" -}}
|
|
{{- $themePath = "css/prism/" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if eq $themePath "" -}}
|
|
{{- $themePath = "css/chroma/" -}}
|
|
{{- end -}}
|
|
|
|
{{- $syntaxCSS := resources.Get (print (path.Join $themePath $theme) ".css") -}}
|
|
|
|
{{- $darkTheme := site.Params.syntax.darkTheme -}}
|
|
{{- if and $darkTheme (ne $darkTheme "") -}}
|
|
{{- if ne $style "light" -}}
|
|
{{- $darkSyntax := resources.Get (print (path.Join $themePath $darkTheme) ".css") -}}
|
|
{{- if $darkSyntax -}}
|
|
{{- if eq $style "dark" -}}
|
|
{{- $syntaxCSS = $darkSyntax -}}
|
|
{{- else -}}
|
|
{{- $darkSyntaxBegin := (print "@media (prefers-color-scheme: dark) {") | resources.FromString "css/tmp_syntax_dark_begin.css" -}}
|
|
{{- $darkSyntaxEnd := (print "}") | resources.FromString "css/tmp_syntax_dark_end.css" -}}
|
|
{{- $darkSyntaxCSS := slice $darkSyntaxBegin $darkSyntax | resources.Concat "css/tmp_syntax_dark_.css" -}}
|
|
{{- $darkSyntaxCSS = slice $darkSyntaxCSS $darkSyntaxEnd | resources.Concat "css/tmp_syntax_dark.css" -}}
|
|
{{- if $syntaxCSS -}}
|
|
{{- $syntaxCSS = slice $syntaxCSS $darkSyntaxCSS | resources.Concat "css/tmp_syntax.css" -}}
|
|
{{- else -}}
|
|
{{- $syntaxCSS = $darkSyntaxCSS -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- if $syntaxCSS -}}
|
|
{{- $coreCSS = slice $coreCSS $syntaxCSS | resources.Concat "css/tmp_core.css" -}}
|
|
{{- end -}}
|
|
|
|
{{- $iconfontCSS := (resources.Get "css/iconfont.css") | resources.ExecuteAsTemplate "css/tmp_iconfont.css" . -}}
|
|
{{- $coreCSS = slice $coreCSS $iconfontCSS | resources.Concat "css/tmp_iconfont_core.css" -}}
|
|
|
|
{{- with partial "custom-css.html" . -}}
|
|
{{- if ne . "" -}}
|
|
{{- $coreCSS = slice $coreCSS . | resources.Concat "css/custom_core.css" -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- $coreCSS = slice $coreCSS ("" | resources.FromString "css/_core.css") | resources.Concat "css/core.css" -}}
|
|
{{- $coreCSS = $coreCSS | resources.Minify | resources.Fingerprint "sha384" -}}
|
|
|
|
<link rel="stylesheet" href="{{- $coreCSS.RelPermalink -}}" integrity="{{- $coreCSS.Data.Integrity -}}"> |