motiejus/e11sync

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/e11sync.git
Log | Tree | Refs | LICENSE

commit cecd679da6409adafaf5e0a4c078e90396585728 (tree)
parent c3ef78605d8950a0ff52a92f86067dc5c42deda7
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Sat, 27 Jan 2024 19:19:51 +0200

style.css: make hash the same

Diffstat:
M.gitignore | 1+
Mapp/e11sync/settings.py | 3+--
Aapp/lib/staticfiles.py | 17+++++++++++++++++
Ablog/assets/grids-responsive.css | 2++
Ablog/assets/pure.css | 2++
Ablog/assets/style.scss | 2++
Mblog/config.yaml | 6+++---
Ablog/content/contact.md | 9+++++++++
Mblog/themes/default/layouts/_default/baseof.html | 36++++++++++++++++--------------------
Mstatic/Makefile | 2+-
Mstatic/style.scss | 2++
11 files changed, 56 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -10,3 +10,4 @@ __pycache__ result .hugo_build.lock +resources/_gen diff --git a/app/e11sync/settings.py b/app/e11sync/settings.py @@ -114,10 +114,9 @@ STATICFILES_FINDERS = [ "django.contrib.staticfiles.finders.AppDirectoriesFinder", ] -_storage = 'django.contrib.staticfiles.storage' STORAGES = { "staticfiles": { - "BACKEND": _storage + ".ManifestStaticFilesStorage", + "BACKEND": 'lib.staticfiles.ManifestStaticFilesStorageSha256' }, } diff --git a/app/lib/staticfiles.py b/app/lib/staticfiles.py @@ -0,0 +1,17 @@ +from hashlib import sha256 + +from django.contrib.staticfiles.storage import ManifestStaticFilesStorage + + +class ManifestStaticFilesStorageSha256(ManifestStaticFilesStorage): + def file_hash(self, name, content=None): + """ + Return a hash of the file with the given name and optional content. + """ + if content is None: + return None + hasher = sha256(usedforsecurity=False) + for chunk in content.chunks(): + hasher.update(chunk) + return hasher.hexdigest() + diff --git a/blog/assets/grids-responsive.css b/blog/assets/grids-responsive.css @@ -0,0 +1 @@ +../../static/grids-responsive.css +\ No newline at end of file diff --git a/blog/assets/pure.css b/blog/assets/pure.css @@ -0,0 +1 @@ +../../static/pure.css +\ No newline at end of file diff --git a/blog/assets/style.scss b/blog/assets/style.scss @@ -0,0 +1 @@ +../../static/style.scss +\ No newline at end of file diff --git a/blog/config.yaml b/blog/config.yaml @@ -6,11 +6,11 @@ author: Motiejus Jakštys Menus: main: - Name: Sign Up - URL: / + URL: ../ - Name: Blog - URL: /blog/ + URL: / - Name: Contact - URL: /contact/ + URL: ../contact/ permalinks: log: '/:year/:slug/' Params: diff --git a/blog/content/contact.md b/blog/content/contact.md @@ -0,0 +1,9 @@ +--- +title: "Contact" +description: "11sync.net contact details" +--- + +- **Email**: [hello@11sync.net](mailto:hello@11sync.net) +- **Libera.chat**: [#11sync on Libera Chat](https://web.libera.chat/#11sync) + +Unless otherwise stated, &copy;Motiejus Jakštys. [CC-BY-ND-4.0](https://creativecommons.org/licenses/by-nd/4.0/). diff --git a/blog/themes/default/layouts/_default/baseof.html b/blog/themes/default/layouts/_default/baseof.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> {{ partial "html-meta.html" . -}} <title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title> -{{ $css := resources.Get "style.css" }} +{{ $css := resources.Get "style.scss" | resources.ToCSS (dict "transpiler" "dartsass" "enableSourceMap" false) | resources.Fingerprint }} <link rel="stylesheet" href="{{ $css.RelPermalink }}"> {{ with .Site.Params.favicon -}} <link rel="shortcut icon" href="{{ . }}" type="image/x-icon"> @@ -18,29 +18,25 @@ /> <link rel="icon" href="data:;base64,iVBORw0KGgo="> </head> -<body> +<body id="page-blog"> +<div> + + <nav> + {{- range .Site.Menus.main -}} + <a href="{{ .URL }}">{{ .Name }}</a> + {{- end -}} + </nav> + <header> - {{ with .Site.Menus.parent -}} - <nav> - {{ range . -}} - <a href="{{ .URL }}">{{ .Name }}</a> - {{ end -}} - </nav> - {{ end -}} - <div> - <h1><a href="/">{{ .Site.Title }}</a></h1> - {{- if .Site.Params.subtitle }}<h2><a href="{{ .Site.BaseURL }}">{{ .Site.Params.subtitle }}</a></h2>{{- end }} - </div> - <nav> - {{- range .Site.Menus.main -}} - <a href="{{ .URL }}">{{ .Name }}</a> - {{- end -}} - </nav> + <h1 class="brand-title"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1> + {{- if .Site.Params.subtitle }} + <h2 class="brand-subtitle"><a href="{{ .Site.BaseURL }}">{{ .Site.Params.subtitle }}</a></h2> + {{- end }} </header> + <main> {{ block "main" . }}{{- end }} </main> - <footer> - </footer> +</div> </body> </html> diff --git a/static/Makefile b/static/Makefile @@ -1,2 +1,2 @@ style.css: style.scss grids-responsive.css pure.css - sass --no-source-map $< $@ + sass --no-charset --no-source-map $< | perl -p -e 'chomp if eof' > $@ diff --git a/static/style.scss b/static/style.scss @@ -113,6 +113,8 @@ header { } nav { + margin: 0 auto; + max-width: 1000px; padding: 10px 0; text-align: right; a {