[go: nahoru, domu]

Skip to content

Commit

Permalink
cache busting for custom CSS, update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
arongergely authored and athul committed Jun 9, 2021
1 parent 27307e7 commit dd1612c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .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) -}}
Expand All @@ -35,16 +35,20 @@
{{ $fontstyle := resources.Get "css/fonts.css" | fingerprint }}
<link href="{{ $fontstyle.Permalink }}" rel="stylesheet">
{{ end }}

{{ $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") -}}
{{ $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" }}
{{ range .Site.Params.customCSS }}
<link rel="stylesheet" type="text/css" href="{{ . | relURL }}">
{{ $customstyle := resources.Get . | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $customstyle.Permalink }}">
{{ end }}
{{- end -}}
{{- range .Site.Params.customJS }}
Expand Down

0 comments on commit dd1612c

Please sign in to comment.