-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathcss.html
More file actions
67 lines (57 loc) · 2.95 KB
/
css.html
File metadata and controls
67 lines (57 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!-- Include all theme CSS filenames here -->
{{- $page := . -}}
{{- $inServerMode := hugo.IsServer -}}
{{- $serverOpts := cond ($inServerMode) (dict "enableSourceMap" true) (dict "outputStyle" "compressed") -}}
{{- $sassCompiler := dict "transpiler" "dartsass" -}}
{{- $cssOpts := collections.Merge $sassCompiler $serverOpts -}}
<!-- Fonts -->
{{ with $fonts := .Site.Params.fonts -}}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
{{ range $fonts }}
{{- $fontFace := replace .name " " "+" -}}
{{- $fontSizes := delimit (.weights | default (slice 300 400 600 700)) ";" -}}
{{- $fontUrl := printf "https://fonts.googleapis.com/css2?family=%s:wght@%s" $fontFace $fontSizes -}}
<link rel="stylesheet" href="{{ $fontUrl }}">
{{- end }}
{{- end }}
<link rel="icon" href="{{ "images/favicon.ico" | relURL }}" />
<!-- Fallback font for symbols (such as "🛈"). -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans+Symbols+2">
<!-- Default theme font (Lato). -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700">
<!-- Process and include Sass files. -->
{{- $sass := append (resources.Get "theme-css/sphinx-design/index.scss")
(resources.Get "theme-css/pst/bootstrap.scss")
(resources.Get "theme-css/pst/pydata-sphinx-theme.scss")
(resources.Get "theme-css/spht/index.scss")
(resources.Match "theme-css/*.scss")
| append (resources.Match "css/*.scss")
-}}
{{- range $sass -}}
{{ with . }} <!-- Skips nil elements from appending empty resources.Match slices. -->
{{- $targetFile := printf "%s.css" .RelPermalink -}}
{{- if $inServerMode -}}
{{ $css := resources.ExecuteAsTemplate $targetFile $page . | toCSS $cssOpts -}}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}">
{{ else }}
{{ $css := resources.ExecuteAsTemplate $targetFile $page . | toCSS $cssOpts | minify | fingerprint -}}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
{{- end -}}
{{- end -}}
{{- end -}}
<!-- Process and include plain CSS files. -->
{{- $themeCssFiles := resources.Match "theme-css/*.css" -}}
{{- $userCssFiles := resources.Match "css/*.css" -}}
{{- $cssFiles := $themeCssFiles | append $userCssFiles }}
{{- range $cssFiles -}}
{{ if $inServerMode -}}
{{ $custom_style := . | resources.ExecuteAsTemplate . $page -}}
<link rel="stylesheet" href="{{ $custom_style.RelPermalink }}">
{{ else }}
{{ $custom_style := . | resources.ExecuteAsTemplate . $page | minify | fingerprint -}}
<link rel="stylesheet" href="{{ $custom_style.RelPermalink }}" integrity="{{ $custom_style.Data.Integrity }}">
{{- end -}}
{{- end -}}