Skip to content

Commit

Permalink
new chroma css processing
Browse files Browse the repository at this point in the history
  • Loading branch information
HidegonSan committed Nov 14, 2023
1 parent 71805d3 commit 79b2346
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 10 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion layouts/partials/extend_footer.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{- partialCached "footer/instant_page.html" . -}}
{{- partial "footer/instant_page.html" . -}}
2 changes: 1 addition & 1 deletion layouts/partials/extend_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{{- partialCached "head/pwa.html" . -}}

{{- partialCached "head/chroma_noscript.html" . -}}
{{- partial "head/css/chroma_css.html" . -}}

{{- partial "head/css/contact_form_css.html" . -}}

Expand Down
7 changes: 0 additions & 7 deletions layouts/partials/head/chroma_noscript.html

This file was deleted.

34 changes: 34 additions & 0 deletions layouts/partials/head/css/chroma_css.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{/* chroma css */}}

{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search")) -}}

{{/* chroma css for noscript */}}
<noscript>
{{- with resources.Get "css/chroma/chroma_noscript.css" | toCSS | minify | fingerprint -}}
<link href="{{- .RelPermalink -}}" integrity="{{- .Data.Integrity -}}" crossorigin="anonymous" rel="preload stylesheet" as="style">
{{- end -}}
</noscript>

{{/* bundle chroma css */}}
{{- $chroma_dark := (resources.Get "css/chroma/chroma_dark.css") -}}
{{- $chroma_light := (resources.Get "css/chroma/chroma_light.css") -}}
{{- $chroma_reset := (resources.Get "css/chroma/chroma_reset.css") -}}
{{- $chroma_tweak := (resources.Get "css/chroma/chroma_tweak.css") -}}
{{- $codeblock_file_name := (resources.Get "css/chroma/codeblock_file_name.css") -}}

{{- $chroma_css := (
slice
$chroma_dark
$chroma_light
$chroma_reset
$chroma_tweak
$codeblock_file_name
)
| resources.Concat "assets/css/chroma/chroma_all.css"
-}}

{{- with $chroma_css | toCSS | minify | fingerprint -}}
<link href="{{- .RelPermalink -}}" integrity="{{- .Data.Integrity -}}" crossorigin="anonymous" rel="preload stylesheet" as="style">
{{- end -}}

{{- end -}}
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/* Added by Hidegon */}}
{{- partialCached "extend_header.html" . -}}
{{- partial "extend_header.html" . -}}

{{- /* theme-toggle is enabled */}}
{{- if (not site.Params.disableThemeToggle) }}
Expand Down

0 comments on commit 79b2346

Please sign in to comment.