Hi everyone.
I got an error when trying to bundle my css resources inside a partial :
error calling Concat: slice []interface {} not supported in concat
Here is the partial, pretty straightforward:
{{ $css := slice }}
{{ range .components }}
{{ if not .critical }}
{{ $r := resources.Get (printf "components/%s.css" .id) }}
{{ $css = $css | append $r }}
{{ end }}
{{ end }}
{{ $css := $css | resources.Concat "bundle.min.css" | postCSS | fingerprint }}
<link rel="stylesheet" href="{{ $css.Permalink | relURL }}" integrity="{{ $css.Data.Integrity }}" media="screen">
I’m on Windows OS 64, then I run
set hugov="0.55.6"
/hugo/bin/%hugov%/hugo.exe version
/hugo/bin/%hugov%/hugo.exe -v server --bind=0.0.0.0 --baseURL=http://0.0.0.0:1313 --navigateToChanged --disableFastRender
I tried on different version of hugo, on extended, I also print the interface on screen, seems everything’s fine before concat func, I’ve got a go slice with page ressource inside as interface.
I saw this error happened back in 2018, bep commit a fix to let the arg type on concat func be more permissive. I’ve been looking for a workaround there. Got a snippet using Scratch instead of slice. I tried but still same error.
Here is the verbose log
INFO 2019/06/14 11:05:20 No translation bundle found for default language "en"
INFO 2019/06/14 11:05:20 Translation func for language en not found, use default.
INFO 2019/06/14 11:05:20 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
INFO 2019/06/14 11:05:20 Using config file:
Building sites … INFO 2019/06/14 11:05:20 syncing static files to C:\Hugo\Sites\blog\
INFO 2019/06/14 11:05:20 No Static directory found
INFO 2019/06/14 11:05:20 found taxonomies: map[string]string{"category":"categories", "tag":"tags"}
WARN 2019/06/14 11:05:20 found no layout file for "HTML" for "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2019/06/14 11:05:20 found no layout file for "HTML" for "section": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2019/06/14 11:05:20 found no layout file for "HTML" for "taxonomyTerm": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
INFO 2019/06/14 11:05:20 postcss: use config file C:\Hugo\Sites\blog\postcss.config.js
INFO 2019/06/14 11:05:22 postcss: use config file C:\Hugo\Sites\blog\postcss.config.js
INFO 2019/06/14 11:05:24 postcss: use config file C:\Hugo\Sites\blog\postcss.config.js
INFO 2019/06/14 11:05:26 postcss: use config file C:\Hugo\Sites\blog\postcss.config.js
ERROR 2019/06/14 11:05:28 render of "page" failed: "C:\Hugo\Sites\blog\themes\dev\layouts\_default\single.html:14:27": execute of template failed: template: _default/single.html:21:5: executing "_default/single.html" at <partial "assetsLoader.gohtml" (dict "c" . "components" .Params.components)>: error calling partial: "C:\Hugo\Sites\blog\themes\dev\layouts\partials\assetsLoader.gohtml:14:27": execute of template failed: template: partials/assetsLoader.gohtml:14:27: executing "partials/assetsLoader.gohtml" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
ERROR 2019/06/14 11:05:28 render of "home" failed: "C:\Hugo\Sites\blog\themes\dev\layouts\index.html:14:27": execute of template failed: template: index.html:27:5: executing "index.html" at <partial "assetsLoader.gohtml" (dict "c" . "components" .Params.components)>: error calling partial: "C:\Hugo\Sites\blog\themes\dev\layouts\partials\assetsLoader.gohtml:14:27": execute of template failed: template: partials/assetsLoader.gohtml:14:27: executing "partials/assetsLoader.gohtml" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
Total in 7911 ms
Error: Error building site: failed to render pages: render of "page" failed: "C:\Hugo\Sites\blog\themes\dev\layouts\_default\single.html:14:27": execute of template failed: template: _default/single.html:21:5: executing "_default/single.html" at <partial "assetsLoader.gohtml" (dict "c" . "components" .Params.components)>: error calling partial: "C:\Hugo\Sites\blog\themes\dev\layouts\partials\assetsLoader.gohtml:14:27": execute of template failed: template: partials/assetsLoader.gohtml:14:27: executing "partials/assetsLoader.gohtml" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
Home someone can help with that.
Thank you.