1

style.css: make hash the same

This commit is contained in:
Motiejus Jakštys 2024-01-27 19:19:51 +02:00
parent c3ef78605d
commit cecd679da6
11 changed files with 53 additions and 26 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ __pycache__
result
.hugo_build.lock
resources/_gen

View File

@ -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'
},
}

17
app/lib/staticfiles.py Normal file
View File

@ -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()

View File

@ -0,0 +1 @@
../../static/grids-responsive.css

1
blog/assets/pure.css Symbolic link
View File

@ -0,0 +1 @@
../../static/pure.css

1
blog/assets/style.scss Symbolic link
View File

@ -0,0 +1 @@
../../static/style.scss

View File

@ -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:

9
blog/content/contact.md Normal file
View File

@ -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, ©Motiejus Jakštys. [CC-BY-ND-4.0](https://creativecommons.org/licenses/by-nd/4.0/).

View File

@ -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>
<header>
{{ with .Site.Menus.parent -}}
<nav>
{{ range . -}}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end -}}
</nav>
{{ end -}}
<body id="page-blog">
<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>
<header>
<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>

View File

@ -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' > $@

View File

@ -113,6 +113,8 @@ header {
}
nav {
margin: 0 auto;
max-width: 1000px;
padding: 10px 0;
text-align: right;
a {