From 404ac00001de49c0ccbff4131be40fa2651e4a06 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 15 Mar 2026 06:42:17 -0700 Subject: [PATCH] create/skeletons: Use css.Build in theme skeleton Closes #14626 --- .../theme/assets/css/components/footer.css | 4 ++++ .../theme/assets/css/components/header.css | 4 ++++ create/skeletons/theme/assets/css/main.css | 13 +++---------- .../theme/layouts/_partials/head/css.html | 16 +++++++++++----- .../theme/layouts/_partials/head/js.html | 5 ++--- 5 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 create/skeletons/theme/assets/css/components/footer.css create mode 100644 create/skeletons/theme/assets/css/components/header.css diff --git a/create/skeletons/theme/assets/css/components/footer.css b/create/skeletons/theme/assets/css/components/footer.css new file mode 100644 index 000000000..abe2b5a6e --- /dev/null +++ b/create/skeletons/theme/assets/css/components/footer.css @@ -0,0 +1,4 @@ +footer { + border-top: 1px solid #222; + margin-top: 1rem; +} diff --git a/create/skeletons/theme/assets/css/components/header.css b/create/skeletons/theme/assets/css/components/header.css new file mode 100644 index 000000000..8efea1e8c --- /dev/null +++ b/create/skeletons/theme/assets/css/components/header.css @@ -0,0 +1,4 @@ +header { + border-bottom: 1px solid #222; + margin-bottom: 1rem; +} diff --git a/create/skeletons/theme/assets/css/main.css b/create/skeletons/theme/assets/css/main.css index 166ade924..6c0b66090 100644 --- a/create/skeletons/theme/assets/css/main.css +++ b/create/skeletons/theme/assets/css/main.css @@ -1,3 +1,6 @@ +@import "components/header.css"; +@import "components/footer.css"; + body { color: #222; font-family: sans-serif; @@ -6,16 +9,6 @@ body { max-width: 768px; } -header { - border-bottom: 1px solid #222; - margin-bottom: 1rem; -} - -footer { - border-top: 1px solid #222; - margin-top: 1rem; -} - a { color: #00e; text-decoration: none; diff --git a/create/skeletons/theme/layouts/_partials/head/css.html b/create/skeletons/theme/layouts/_partials/head/css.html index d76d23a16..889786684 100644 --- a/create/skeletons/theme/layouts/_partials/head/css.html +++ b/create/skeletons/theme/layouts/_partials/head/css.html @@ -1,9 +1,15 @@ {{- with resources.Get "css/main.css" }} - {{- if hugo.IsDevelopment }} - - {{- else }} - {{- with . | minify | fingerprint }} - + {{- $opts := dict + "minify" (cond hugo.IsDevelopment false true) + "sourceMap" (cond hugo.IsDevelopment "linked" "none") + }} + {{- with . | css.Build $opts }} + {{- if hugo.IsDevelopment }} + + {{- else }} + {{- with . | fingerprint }} + + {{- end }} {{- end }} {{- end }} {{- end }} diff --git a/create/skeletons/theme/layouts/_partials/head/js.html b/create/skeletons/theme/layouts/_partials/head/js.html index 16ffbedfe..0210efa8b 100644 --- a/create/skeletons/theme/layouts/_partials/head/js.html +++ b/create/skeletons/theme/layouts/_partials/head/js.html @@ -1,8 +1,7 @@ {{- with resources.Get "js/main.js" }} {{- $opts := dict - "minify" (not hugo.IsDevelopment) - "sourceMap" (cond hugo.IsDevelopment "external" "") - "targetPath" "js/main.js" + "minify" (cond hugo.IsDevelopment false true) + "sourceMap" (cond hugo.IsDevelopment "linked" "none") }} {{- with . | js.Build $opts }} {{- if hugo.IsDevelopment }} -- 2.39.5