Skip to content

Commit

Permalink
improved resource loading
Browse files Browse the repository at this point in the history
  • Loading branch information
NotLe0n committed Oct 21, 2024
1 parent 2b1516b commit 186595d
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 129 deletions.
9 changes: 6 additions & 3 deletions assets/css/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
:root {
--sidebar-size: 280px;
--content-size: calc(100% - var(--sidebar-size));
--theme-toggle-img: url(/Bedienungsanleitung/img/theme-light-dark.svg);
--title-img: url(/Bedienungsanleitung/img/title.svg);
--line-img: url(/Bedienungsanleitung/img/line.svg);
}

:root:has(#dark-mode-check:checked) {
Expand Down Expand Up @@ -172,22 +175,22 @@ a:hover {

#kopf #titel {
background-color: var(--text-color);
mask: url(/Bedienungsanleitung/img/title.svg) no-repeat center / contain;
mask: var(--title-img) no-repeat center / contain;
display: block;
width: clamp(310px, 60vw, 550px);
aspect-ratio: 9/1;
}

#linie {
background: url(/Bedienungsanleitung/img/line.svg) no-repeat center / contain;
background: var(--line-img) no-repeat center / contain;
}

#kopf #toggles {
margin-top: 1rem;
}

#kopf #toggles #dark-mode-check {
background: url(/Bedienungsanleitung/img/theme-light-dark.svg) no-repeat center;
background: var(--theme-toggle-img) no-repeat center;
width: 30px;
height: 20px;
appearance: none;
Expand Down
6 changes: 1 addition & 5 deletions assets/img/de.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/img/en.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 12 additions & 69 deletions assets/img/line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 7 additions & 42 deletions assets/img/title.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ externImpl = "Implementiert in"
type = "Typ"
siteLink = "zur Englischen Seite"
ldMode = "Hell-/Dunkelmodus"
otherFlag = "en.svg"
otherFlag = "assets/img/en.svg"
2 changes: 1 addition & 1 deletion i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ externImpl = "Implemented in"
type = "Type"
siteLink = "to German site"
ldMode = "light/dark mode"
otherFlag = "de.svg"
otherFlag = "assets/img/de.svg"
14 changes: 9 additions & 5 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@
<link rel="shortcut icon" href="favicon/favicon.ico">

{{- range resources.Match "fonts/*" -}}
{{.Publish}}
<link rel="preload" as="font" href="{{ .RelPermalink }}" type="font/ttf" crossorigin>
{{ end }}

{{- range resources.Match "img/*" -}} {{.Publish}} {{ end }}


<link rel="preload" href="/Bedienungsanleitung/img/line.svg" as="image" type="image/svg+xml">
<link rel="preload" href="/Bedienungsanleitung/img/theme-light-dark.svg" as="image" type="image/svg+xml">
<link rel="preload" href="/Bedienungsanleitung/img/title.svg" as="image" type="image/svg+xml" crossorigin>

{{- $mdStyle := resources.Get "css/md-style.css" | fingerprint }}
<link rel="preload" as="style" href="{{ $mdStyle.RelPermalink }}" integrity="{{ $mdStyle.Data.Integrity }}">

{{- $style := resources.Get "css/style.css" | fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}">

<script defer>
class TODOElement extends HTMLElement {
constructor() {
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<header id="kopf">
<s id="linie"><a href="https://ddp.le0n.dev" alt="titel" id="titel" title="homepage"></a></s>
<div id="toggles">
<a href="{{ (index .Translations 0).Permalink}}">
<img id="sprach-toggle" alt="sprach-toggle" src='img/{{ T "otherFlag" }}' title='{{ T "siteLink" }}' width="30" height="20">
<a href="{{ (index .Translations 0).Permalink}}" title='{{ T "siteLink" }}'>
{{ readFile (T "otherFlag") | safeHTML }}
</a>
<input type="checkbox" id="dark-mode-check" title='{{ T "ldMode" }}' checked>
</div>
Expand Down

0 comments on commit 186595d

Please sign in to comment.