Getting build errors on my sites after Hugo update

Here is my current hugo version.

hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371 linux/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio

The following code worked fine until the most recent hugo version. This output comes from the standard version of hugo on my server that rebuilds my sites via cron job.

{{- $styles := slice -}}
{{- $cssOpts := (dict "targetPath" "css/player.css" "outputStyle" "compressed" "enableSourceMap" true ) -}}
{{- $styles = $styles | append (resources.Get "css/player/mediaelementplayer.css") -}}
{{- $styles = $styles | append (resources.Get "css/player/jump-forward.css") -}}
{{- $styles = $styles | append (resources.Get "css/player/skip-back.css") -}}
{{- $styles = $styles | append (resources.Get "css/player/speed.css") -}}
{{- $styles = $styles | append (resources.Get "scss/player.scss" | resources.ExecuteAsTemplate "style.player.css" . | toCSS $cssOpts) -}}

{{ if .Site.IsServer -}}
    {{- $style := $styles | resources.Concat "css/empire-player-styles.css" -}}
    <link rel="stylesheet" href="{{ $style.RelPermalink }}" media="screen">
{{- else -}}
    {{- $style := $styles | resources.Concat "css/empire-player-styles.css" | minify | fingerprint -}}
    <link rel="stylesheet" href="{{ $style.RelPermalink }}" integrity="{{ $style.Data.Integrity }}" crossorigin="anonymous" media="screen" />
{{- end -}}

{{- $scripts := slice -}}
{{- $scripts = $scripts | append (resources.Get "js/player/mediaelement-and-player.js") -}}
{{- $scripts = $scripts | append (resources.Get "js/player/jump-forward.js") -}}
{{- $scripts = $scripts | append (resources.Get "js/player/skip-back.js") -}}
{{- $scripts = $scripts | append (resources.Get "js/player/speed.js") -}}
{{- $scripts = $scripts | append (resources.Get "js/player/audio-player.js") -}}

{{ if .Site.IsServer -}}
    {{- $js := $scripts | resources.Concat "js/empire-player-script.js" -}}
    <script src="{{ $js.RelPermalink }}"></script>
{{- else -}}
    {{- $js := $scripts | resources.Concat "js/empire-player-script.js" | minify | fingerprint -}}
    <script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>
{{- end -}}

It now spits out the following list of errors

hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371 linux/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio

ERROR 2022/12/25 07:17:05 render of "page" failed: "/home/empire/repo/themes/empire/layouts/episode/single.html:21:3": execute of template failed: template: episode/single.html:21:3: executing "main" at <partial "player-includes" .>: error calling partial: "/home/empire/repo/themes/empire/layouts/partials/player-includes.html:13:37": execute of template failed: template: partials/player-includes.html:13:37: executing "partials/player-includes.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"

ERROR 2022/12/25 07:17:05 render of "page" failed: "/home/empire/repo/themes/empire/layouts/episode/single.html:21:3": execute of template failed: template: episode/single.html:21:3: executing "main" at <partial "player-includes" .>: error calling partial: "/home/empire/repo/themes/empire/layouts/partials/player-includes.html:13:37": execute of template failed: template: partials/player-includes.html:13:37: executing "partials/player-includes.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"

ERROR 2022/12/25 07:17:05 render of "page" failed: "/home/empire/repo/themes/empire/layouts/episode/single.html:21:3": execute of template failed: template: episode/single.html:21:3: executing "main" at <partial "player-includes" .>: error calling partial: "/home/empire/repo/themes/empire/layouts/partials/player-includes.html:13:37": execute of template failed: template: partials/player-includes.html:13:37: executing "partials/player-includes.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"

ERROR 2022/12/25 07:17:05 render of "page" failed: "/home/empire/repo/themes/empire/layouts/episode/single.html:21:3": execute of template failed: template: episode/single.html:21:3: executing "main" at <partial "player-includes" .>: error calling partial: "/home/empire/repo/themes/empire/layouts/partials/player-includes.html:13:37": execute of template failed: template: partials/player-includes.html:13:37: executing "partials/player-includes.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"

I am also getting new errors regarding sass compilation.

ERROR 2022/12/25 07:17:05 TOCSS: failed to transform "fork-awesome.css" (text/css). Check your Hugo installation; you need the extended version to build SCSS/SASS with transpiler set to 'libsass'.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information

ERROR 2022/12/25 07:17:05 TOCSS: failed to transform "style.empire.css" (text/x-scss). Check your Hugo installation; you need the extended version to build SCSS/SASS with transpiler set to 'libsass'.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information

ERROR 2022/12/25 07:17:05 TOCSS: failed to transform "style.empire-dark.css" (text/x-scss). Check your Hugo installation; you need the extended version to build SCSS/SASS with transpiler set to 'libsass'.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information

ERROR 2022/12/25 07:17:05 TOCSS: failed to transform "style.player.css" (text/x-scss). Check your Hugo installation; you need the extended version to build SCSS/SASS with transpiler set to 'libsass'.: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information

Error: Error building site: failed to render pages: render of "page" failed: "/home/empire/repo/themes/empire/layouts/episode/single.html:21:3": execute of template failed: template: episode/single.html:21:3: executing "main" at <partial "player-includes" .>: error calling partial: "/home/empire/repo/themes/empire/layouts/partials/player-includes.html:13:37": execute of template failed: template: partials/player-includes.html:13:37: executing "partials/player-includes.html" at <resources.Concat>: error calling Concat: resources in Concat must be of the same Media Type, got "text/x-scss" and "text/css"

Total in 1297 ms

This code has always compiled fine in standard hugo on my server before by including the intermediate scss build resources in the repo from the extended version on my desktop.

Is this a breaking change in hugo by design that I need to account for or are they possibly bugs introduced in the new hugo version?

Any help is appreciated.

Are installing extended version changes anything?

We added a new option to toCss (vars) which in your case means that the fingerprint of the SCSS files has changed and the cache needs to be repopulated.

This is unfortunate and I didn’t think about this when I added this flag (not that thinking about it would have made much difference, other than I could have mentioned it in the release notes), as in all the other similar components have been updated to a pattern that uses a more stable hash.

But in your situation, you need to do a local build (e.g. with --gc) and commit the updated source.

That cleared it right up. Thanks!

I just prefer to keep the regular version on my server. Eventually someone else may use this theme besides me. I don’t want to have to require them to have extended. Some setups don’t give people the option. By including the resource cache in the repo, they don’t need extended version and rebuilding that as Bep suggested worked. Cheers!

The extended version is the default now, or rather is the suggested option to use.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.