1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 21:02:09 +00:00

Inline CSS

The main stylesheet for the sit is just 721 bytes uncompressed. I can
inline it safely to shave off a request, since the headers alone are
probably comparable to the size of the CSS.
This commit is contained in:
Rohan Kumar 2021-06-04 16:44:43 -07:00
parent 2abdb82cb3
commit 55d99287b4
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479

View file

@ -27,10 +27,11 @@
{{ if not (eq $dark "off") -}} {{ if not (eq $dark "off") -}}
{{ $resources = $resources | append (resources.Get "css/dark.css" | resources.ExecuteAsTemplate "dark.css" .) -}} {{ $resources = $resources | append (resources.Get "css/dark.css" | resources.ExecuteAsTemplate "dark.css" .) -}}
{{ end -}} {{ end -}}
{{ $css := $resources | resources.Concat "css/style.css" | minify | resources.Fingerprint "sha384" -}} {{ $css := $resources | resources.Concat "css/style.css" | minify -}}
{{ printf `<link rel="stylesheet" href="%s" integrity="%s">` $css.RelPermalink $css.Data.Integrity | safeHTML -}} <!-- {{ printf `<link rel="stylesheet" href="%s" integrity="%s">` $css.RelPermalink $css.Data.Integrity | safeHTML -}} -->
<style>{{ $css.Content | safeCSS }}</style>
<!-- only load syntax-highlighting CSS if this page needs it --> <!-- only load syntax-highlighting CSS if this page needs it -->
{{ if .Params.highlight -}} {{- if .Params.highlight -}}
{{ $css_syntax := resources.Get "/css/syntax.css" | minify | resources.Fingerprint "sha384" -}} {{ $css_syntax := resources.Get "/css/syntax.css" | minify | resources.Fingerprint "sha384" -}}
{{- printf `<link rel="stylesheet" href="%s" integrity="%s">` $css_syntax.RelPermalink $css_syntax.Data.Integrity | safeHTML }} {{- printf `<link rel="stylesheet" href="%s" integrity="%s">` $css_syntax.RelPermalink $css_syntax.Data.Integrity | safeHTML }}
{{- end -}} {{- end -}}