Skip to content

Commit 6ca569c

Browse files
committed
Fingerprint CSS file and use method aliases.
Fingerprinting a static file ensures that when the content changes, the browser cache is invalidated (because the filename changes). Otherwise a return visitor may not see the latest changes to the site. https://gohugo.io/hugo-pipes/fingerprint/ I also switched to using the method aliases instead of specifying the full path to resources: * toCSS => resources.ToCSS * minify => resources.Minify * fingerprint => resources.Fingerprint https://gohugo.io/hugo-pipes/introduction/#method-aliases Recall that I don't need to explicitly call minify, because I pass "compressed" to toCSS, which is supposed to be better at minifying the CSS file. https://gohugo.io/hugo-pipes/scss-sass/
1 parent a9b4497 commit 6ca569c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

layouts/partials/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"> -->
66
{{ $sass := resources.Get "sass/main.scss" }}
77
{{ $options := (dict "targetPath" "css/main.css" "outputStyle" "compressed" ) }}
8-
{{ $style := $sass | resources.ToCSS $options }}
8+
{{ $style := $sass | toCSS $options | fingerprint }}
99
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
1010
<link rel="stylesheet" href="/css/fontawesome.min.css">
1111
<link rel="stylesheet" href="/css/brands.min.css">

0 commit comments

Comments
 (0)