Converting from sass to nested vanilla css with layers (#147)

This commit is contained in:
Fredrik Jonsson 2026-03-10 14:14:55 +01:00 • committed by GitHub
commit 57244c3f33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2687 additions and 2751 deletions

View file

@ -5,7 +5,7 @@
{{ $opts = merge $opts (dict "minify" false) -}}
{{ end -}}
{{ $early := resources.Get "js/script-early.js" | js.Build $opts | fingerprint -}}
{{ $early := resources.Get "js/script-early.js" | js.Build $opts -}}
<script>
{{ $early.Content | safeJS }}
</script>

View file

@ -1,17 +1,12 @@
{{ $main_options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" false "transpiler" (site.Params.sassTranspiler | default "libsass")) -}}
{{ if eq hugo.Environment "development" -}}
{{ $main_options = merge $main_options (dict "outputStyle" "nested" "enableSourceMap" true) -}}
{{ end -}}
{{ $mobile_options := merge $main_options (dict "targetPath" "css/mobilemenu.css") -}}
{{ $print_options := merge $main_options (dict "targetPath" "css/print.css") -}}
{{ $main_style := resources.Get "sass/styles.scss" | toCSS $main_options -}}
{{ $mobile_style := resources.Get "sass/mobilemenu.scss" | toCSS $mobile_options -}}
{{ $print_style := resources.Get "sass/print.scss" | toCSS $print_options -}}
{{ $main_style := resources.Match "css/_*.css" | append (resources.Match "css/**/_*.css") | resources.Concat "css/styles.css" -}}
{{ $mobile_style := resources.Get "css/mobilemenu.css" -}}
{{ $print_style := resources.Get "css/print.css" -}}
{{ if ne hugo.Environment "development" -}}
{{ $main_style = $main_style | fingerprint -}}
{{ $mobile_style = $mobile_style | fingerprint -}}
{{ $print_style = $print_style | fingerprint -}}
{{ $main_style = $main_style | minify | fingerprint -}}
{{ $mobile_style = $mobile_style | minify | fingerprint -}}
{{ $print_style = $print_style | minify | fingerprint -}}
{{ end -}}
{{ with resources.Get "css/layers-init.css" }}<style>{{ .Content | safeCSS }}</style>{{ end }}
<link rel="stylesheet" href="{{ $main_style.RelPermalink }}">
{{ if $.Param "mobilemenu" -}}
<link rel="stylesheet" href="{{ $mobile_style.RelPermalink }}" media="screen">