refactor: every project landing has its own theme
- landing.css is layout only and uses tokens (colors, fonts, hero, nav) - palettes live in css/landing-<theme>.css; Robotex gets its own dark theme, MyPointVPN sets the same tokens - theme defaults to the project folder name; the build fails if the theme file is missing, so a landing can't ship without styles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d0c0b485c6
commit
f7d0f27faa
4 files changed
+66
-40
No files matched your search
@@ -6,11 +6,12 @@
|
||||
*/ -}}
|
||||
{{- $p := .Params -}}
|
||||
{{- $home := cond (eq .Language.Lang hugo.Sites.Default.Language.Lang) "/" (printf "/%s/" .Language.Lang) -}}
|
||||
{{- $css := resources.Get "css/landing.css" -}}
|
||||
{{- /* params.theme adds css/landing-<theme>.css on top of the base styles */ -}}
|
||||
{{- with $p.theme }}{{ with resources.Get (printf "css/landing-%s.css" .) }}
|
||||
{{- $css = slice $css . | resources.Concat (printf "css/landing-%s.bundle.css" $p.theme) }}
|
||||
{{- end }}{{ end -}}
|
||||
{{- /* Every landing has its own theme: css/landing-<theme>.css on top of the layout in
|
||||
css/landing.css. The theme is params.theme or, by default, the project folder name. */ -}}
|
||||
{{- $theme := $p.theme | default .File.ContentBaseName -}}
|
||||
{{- $themeCSS := resources.Get (printf "css/landing-%s.css" $theme) -}}
|
||||
{{- if not $themeCSS }}{{ errorf "landing %q: theme file assets/css/landing-%s.css not found" .File.Path $theme }}{{ end -}}
|
||||
{{- $css := slice (resources.Get "css/landing.css") $themeCSS | resources.Concat (printf "css/landing-%s.bundle.css" $theme) -}}
|
||||
{{- $css = $css | minify | fingerprint -}}
|
||||
{{- $fonts := $p.fonts | default "family=Inter:wght@400;600;800&family=JetBrains+Mono:wght@400;600" -}}
|
||||
<!doctype html>
|
||||
@@ -35,7 +36,7 @@
|
||||
<link href="https://fonts.googleapis.com/css2?{{ $fonts | safeURL }}&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
|
||||
</head>
|
||||
<body{{ with $p.theme }} class="theme-{{ . }}"{{ end }}>
|
||||
<body class="theme-{{ $theme }}">
|
||||
<header class="nav">
|
||||
<div class="wrap nav__row">
|
||||
<a class="nav__logo" href="{{ $home }}">{{ .Title }}</a>
|
||||
|
||||
Reference in new issue
Block a user