Repository: gohugoio/hugo (language: go)

Issue:
Log spam caused by `try`
I think `try` might have some debug logging enabled. When I use `{{ $width := (try $resource.Width) }}` I get a bunch of logging of what looks like the SubType of the resource
```
Start building sites …

x-icon
x-icon    
css       
css       
x-icon    
css       
x-icon    
css       
x-icon    
css       
x-icon    
css       
x-icon    
css       
javascript
javascript
javascript
javascript
javascript
javascript
javascript
x-icon
x-icon
css
css
...
```

### What version of Hugo are you using (`hugo version`)?

<pre>
hugo v0.142.0-1f746a872442e66b6afd47c8c04ac42dc92cdb6f+extended windows/amd64 BuildDate=2025-01-22T12:20:52Z VendorInfo=gohugoio
</pre>

### Does this issue reproduce with the latest release?
Yes



Discussion / hints:
> `{{ $width := (try $resource.Width) }}`

That construct is eating the error. See <https://gohugo.io/functions/go-template/try/>. Do this instead:

```text
{{ with try $resource.Width }}
  {{ with .Err }}
    {{ errorf "%s" . }}
  {{ else }}
    {{ fmt.Printf "The width is %v" .Value }}
  {{ end }}
{{ end }}
```

Directly above the error you will see the media subtype. We'll remove that.

If you _want_ to ignore the error, perhaps while ranging over a collection of resources:

```text
{{ range resources.Match "*" }}
  {{ with try .Width }}
    {{ fmt.Printf "The width is %v" .Value }}
  {{ end }}
{{ end }}
```

Fix patch:
diff --git a/resources/transform.go b/resources/transform.go
index 73f3b85d25d..abb55f3ccdd 100644
--- a/resources/transform.go
+++ b/resources/transform.go
@@ -388,7 +388,6 @@ func (r *resourceAdapter) getImageOps() images.ImageResourceOps {
 		if r.MediaType().SubType == "svg" {
 			panic("this method is only available for raster images. To determine if an image is SVG, you can do {{ if eq .MediaType.SubType \"svg\" }}{{ end }}")
 		}
-		fmt.Println(r.MediaType().SubType)
 		panic("this method is only available for image resources")
 	}
 	r.init(false, false)


Test patch:
diff --git a/resources/resource_transformers/cssjs/tailwindcss_integration_test.go b/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
index c0d6d3dff45..ae70042a08c 100644
--- a/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
+++ b/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
@@ -36,8 +36,8 @@ func TestTailwindV4Basic(t *testing.T) {
     "url": "https://github.com/bep/hugo-starter-tailwind-basic.git"
   },
   "devDependencies": {
-    "@tailwindcss/cli": "^4.0.0-alpha.26",
-    "tailwindcss": "^4.0.0-alpha.26"
+    "@tailwindcss/cli": "^4.0.1",
+    "tailwindcss": "^4.0.1"
   },
   "name": "hugo-starter-tailwind-basic",
   "version": "0.1.0"
@@ -68,5 +68,5 @@ CSS: {{ $css.Content | safeCSS }}|
 			LogLevel:        logg.LevelInfo,
 		}).Build()
 
-	b.AssertFileContent("public/index.html", "/*! tailwindcss v4.0.0")
+	b.AssertFileContent("public/index.html", "/*! tailwindcss v4.")
 }