all repos — archie @ 27307e797f86cbf40f9d8a62fc4274dad0440df7

A minimal Hugo Theme

add cache busting for CSS files via Hugo Pipes
Aron Gergely aron.gergely@rasterra.nl
Fri, 04 Jun 2021 23:34:27 +0200
commit

27307e797f86cbf40f9d8a62fc4274dad0440df7

parent

117808b653817e8ff7c7fc747361d2227de07a82

4 files changed, 6 insertions(+), 3 deletions(-)

jump to
M layouts/partials/header.htmllayouts/partials/header.html

@@ -32,11 +32,14 @@ <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@1,500&display=swap" rel="stylesheet">

<link href="https://fonts.googleapis.com/css2?family=Fira+Sans&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet"> {{- else -}} - <link href="{{ .Site.BaseURL }}css/fonts.css" rel="stylesheet"> + {{ $fontstyle := resources.Get "css/fonts.css" | fingerprint }} + <link href="{{ $fontstyle.Permalink }}" rel="stylesheet"> {{ end }} - <link rel="stylesheet" type="text/css" media="screen" href="{{ .Site.BaseURL }}css/main.css" /> + {{ $style := resources.Get "css/main.css" | fingerprint }} + <link rel="stylesheet" type="text/css" media="screen" href="{{ $style.Permalink }}" /> {{- if or (eq .Site.Params.mode "auto") (eq .Site.Params.mode "dark") -}} - <link rel="stylesheet" type="text/css" href="{{ .Site.BaseURL }}css/dark.css" {{ if eq .Site.Params.mode "auto" }}media="(prefers-color-scheme: dark)"{{ end }} /> + {{ $darkstyle := resources.Get "css/dark.css" | fingerprint }} + <link rel="stylesheet" type="text/css" href="{{ $darkstyle.Permalink }}" {{ if eq .Site.Params.mode "auto" }}media="(prefers-color-scheme: dark)"{{ end }} /> {{ end }} <!-- Custom CSS style get applied last --> {{- if isset .Site.Params "customcss" }}