Skip to content

Commit

Permalink
feat: add explicit fingerprint algo
Browse files Browse the repository at this point in the history
  • Loading branch information
gcushen committed Oct 27, 2023
1 parent f1c8e66 commit 127cd79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions modules/wowchemy-tailwind/layouts/partials/libraries.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ $mermaid_js := resources.Get "dist/lib/mermaid/mermaid.min.js" }}
{{ $mermaid_config_js := resources.Get "js/wowchemy-mermaid-config.js" }}
{{ $mermaid_config_js = $mermaid_config_js | resources.Minify }}
{{ $mermaid_bundle := slice $mermaid_js $mermaid_config_js | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint }}
{{ $mermaid_bundle := slice $mermaid_js $mermaid_config_js | resources.Concat "js/mermaid.bundle.js" | resources.Fingerprint "sha256" }}
<script defer src="{{ $mermaid_bundle.RelPermalink }}" integrity="{{ $mermaid_bundle.Data.Integrity }}"></script>
{{ end }}

Expand All @@ -28,20 +28,20 @@
};
</script>
{{ $markmap_js := resources.Get "dist/lib/markmap/index.js" }}
{{ $markmap_js = $markmap_js | resources.Minify | resources.Fingerprint }}
{{ $markmap_js = $markmap_js | resources.Minify | resources.Fingerprint "sha256" }}
<script defer src="{{ $markmap_js.RelPermalink }}" integrity="{{ $markmap_js.Data.Integrity }}"></script>
{{ end }}

{{/* Katex */}}
{{ if (.Page.HasShortcode "math") | or .Params.math | or site.Params.features.math.enable }}
{{ $katex_css := resources.Get "dist/lib/katex/katex.min.css" }}
{{ $katex_css = $katex_css | resources.Fingerprint }}
{{ $katex_css = $katex_css | resources.Fingerprint "sha256" }}
<link type="text/css" rel="stylesheet" href="{{ $katex_css.RelPermalink }}" integrity="{{ $katex_css.Data.Integrity }}" />
{{ $katex_js := resources.Get "dist/lib/katex/katex.min.js" }}
{{ $katex_js = $katex_js | resources.Fingerprint }}
{{ $katex_js = $katex_js | resources.Fingerprint "sha256" }}
<script defer src="{{ $katex_js.RelPermalink }}" integrity="{{ $katex_js.Data.Integrity }}"></script>
{{ $katex_render_js := resources.Get "dist/lib/katex/auto-render.min.js" }}
{{ $katex_render_js = $katex_render_js | resources.Fingerprint }}
{{ $katex_render_js = $katex_render_js | resources.Fingerprint "sha256" }}
<script defer src="{{ $katex_render_js.RelPermalink }}" integrity="{{ $katex_render_js.Data.Integrity }}" onload="renderMathInElement(document.body);"></script>
{{ $katex_fonts := resources.Match "dist/lib/katex/fonts/*" }}
{{ range $katex_fonts }}
Expand All @@ -52,6 +52,6 @@
{{/* Plotly */}}
{{ if .Page.HasShortcode "chart" }}
{{ $plotly_js := resources.Get "dist/lib/plotly/plotly.min.js" }}
{{ $plotly_js = $plotly_js | resources.Fingerprint }}
{{ $plotly_js = $plotly_js | resources.Fingerprint "sha256" }}
<script defer src="{{ $plotly_js.RelPermalink }}" integrity="{{ $plotly_js.Data.Integrity }}"></script>
{{ end }}
4 changes: 2 additions & 2 deletions modules/wowchemy-tailwind/layouts/partials/site_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{{ $styles := resources.Get "css/styles.css" }}
{{ $styles = $styles | resources.PostCSS $options }}
{{ if hugo.IsProduction }}
{{ $styles = $styles | minify | fingerprint | resources.PostProcess }}
{{ $styles = $styles | minify | fingerprint "sha256" | resources.PostProcess }}
{{ end }}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet" />
{{ end }}
Expand Down Expand Up @@ -289,7 +289,7 @@
{{ $js_academic := $js_academic | resources.Minify }}
{{ $js_bundle := slice $js_bundle_head $js_academic | resources.Concat (printf "js/wowchemy-%s.min.js" .Lang) }}
{{- if hugo.IsProduction -}}
{{ $js_bundle = $js_bundle | fingerprint "md5" }}
{{ $js_bundle = $js_bundle | fingerprint "sha256" }}
{{- end -}}
<script
defer
Expand Down

0 comments on commit 127cd79

Please sign in to comment.