From dd1612c482e9fd993efe41f2783bbabed9b1e4cc Mon Sep 17 00:00:00 2001 From: Aron Gergely Date: Tue, 8 Jun 2021 21:57:36 +0200 Subject: [PATCH] cache busting for custom CSS, update readme --- README.md | 16 +++++++++++++++- layouts/partials/header.html | 8 ++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89562fd..34b0011 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Forked from [Ezhil Theme](https://github.com/vividvilla/ezhil) - Tags - Auto Dark Mode(based on system theme) - tl:dr; frontamatter +- Cache busting for CSS files ## Installation In your Hugo website directory, create a new folder named theme and clone the repo @@ -40,11 +41,24 @@ tags: [tag names] (optional) ``` ## Credits -Forked from [Ezhil Theme](https://github.com/vividvilla/ezhil) and Licensed under MIT License +Forked from [Ezhil Theme](https://github.com/vividvilla/ezhil) and Licensed under MIT License Inspired by design of blog.jse.li ---- +## Config Options + +### Custom CSS +Custom CSS files can be included though the `customcss` config parameter. + +Note: CSS files should be placed under the `assets` directory e.g. `assets/css/first.css`. + +```toml +[params] + customcss = ["css/first.css", "css/second.css"] +``` + + ## Config of the Demo Site ```toml diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 8914b7d..c5ae589 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -19,7 +19,7 @@ {{ with .OutputFormats.Get "rss" -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} - + {{- template "_internal/opengraph.html" . -}} {{- template "_internal/twitter_cards.html" . -}} {{ if and (isset .Site.Params "social") (.Site.Params.useCDN | default false) -}} @@ -35,16 +35,20 @@ {{ $fontstyle := resources.Get "css/fonts.css" | fingerprint }} {{ end }} + {{ $style := resources.Get "css/main.css" | fingerprint }} + {{- if or (eq .Site.Params.mode "auto") (eq .Site.Params.mode "dark") -}} {{ $darkstyle := resources.Get "css/dark.css" | fingerprint }} {{ end }} + {{- if isset .Site.Params "customcss" }} {{ range .Site.Params.customCSS }} - + {{ $customstyle := resources.Get . | fingerprint }} + {{ end }} {{- end -}} {{- range .Site.Params.customJS }}