From 1a5191d78d10a36c722060e5b3f891064b2bd0c3 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 25 Apr 2025 20:58:17 -0700 Subject: [PATCH] content: Update transformation examples --- content/en/functions/css/Sass.md | 10 +++++----- content/en/functions/css/TailwindCSS.md | 8 ++++---- content/en/functions/js/Build.md | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/content/en/functions/css/Sass.md b/content/en/functions/css/Sass.md index 03a4c7451..6f9a68de0 100644 --- a/content/en/functions/css/Sass.md +++ b/content/en/functions/css/Sass.md @@ -66,20 +66,20 @@ vars ```go-html-template {copy=true} {{ with resources.Get "sass/main.scss" }} {{ $opts := dict - "enableSourceMap" (not hugo.IsProduction) - "outputStyle" (cond hugo.IsProduction "compressed" "expanded") + "enableSourceMap" hugo.IsDevelopment + "outputStyle" (cond hugo.IsDevelopment "expanded" "compressed") "targetPath" "css/main.css" "transpiler" "dartsass" "vars" site.Params.styles "includePaths" (slice "node_modules/bootstrap/scss") }} {{ with . | toCSS $opts }} - {{ if hugo.IsProduction }} + {{ if hugo.IsDevelopment }} + + {{ else }} {{ with . | fingerprint }} {{ end }} - {{ else }} - {{ end }} {{ end }} {{ end }} diff --git a/content/en/functions/css/TailwindCSS.md b/content/en/functions/css/TailwindCSS.md index 6add7373a..d323f7dcb 100644 --- a/content/en/functions/css/TailwindCSS.md +++ b/content/en/functions/css/TailwindCSS.md @@ -76,16 +76,16 @@ Create a partial template to process the CSS with the Tailwind CSS CLI: {{ with (templates.Defer (dict "key" "global")) }} {{ with resources.Get "css/main.css" }} {{ $opts := dict - "minify" hugo.IsProduction + "minify" (not hugo.IsDevelopment) "inlineImports" true }} {{ with . | css.TailwindCSS $opts }} - {{ if hugo.IsProduction }} + {{ if hugo.IsDevelopment }} + + {{ else }} {{ with . | fingerprint }} {{ end }} - {{ else }} - {{ end }} {{ end }} {{ end }} diff --git a/content/en/functions/js/Build.md b/content/en/functions/js/Build.md index 1bec6b16f..d55220a52 100644 --- a/content/en/functions/js/Build.md +++ b/content/en/functions/js/Build.md @@ -20,18 +20,18 @@ The `js.Build` function uses the [evanw/esbuild] package to: ```go-html-template {{ with resources.Get "js/main.js" }} - {{ $opts := dict - "minify" hugo.IsProduction - "sourceMap" (cond hugo.IsProduction "" "external") + {{$opts := dict + "minify" (not hugo.IsDevelopment) + "sourceMap" (cond hugo.IsDevelopment "external" "") "targetPath" "js/main.js" }} {{ with . | js.Build $opts }} - {{ if hugo.IsProduction }} + {{ if hugo.IsDevelopment }} + + {{ else }} {{ with . | fingerprint }} {{ end }} - {{ else }} - {{ end }} {{ end }} {{ end }}