.Resource meta/properties branch bundles


Looking back at how you guys came up with Hugo’s pipe here:


It looks like .Resources.GetMatch didn’t end up behaving the same as resources.Get, in terms of delivering a file ready for transformation.

Fetching an .scss from a page bundle, concatenating it with an .scss from assets/ then putting them together through the pipe for transformation just pisses ExecuteAsTemplate off.

In content/section/_index.md:

pageScss = "page.scss"

In content/section/page.scss:

$somevariable = 1fr;

In assets/: global.scss

In assets/global.scss:

$someothervariable = 1fr 1fr;

In layouts/section/:

In _default/baseof.html:

{{$globalScss := ""}}
{{- $globalScss := resources.Get "assets/global.scss" -}}

{{$pageScss := ""}}
{{if .Params.pageScss}}
{{with .Resources.GetMatch .Params.pageScss }}
{{- $pageScss = .Content -}}
{{ end }}
{{ end }}

{{- $bundle := slice $globalScss $pageScss | resources.Concat "scss/bundle.scss" | resources.ExecuteAsTemplate "scss/bundleparsed.scss" . | toCSS  | fingerprint -}}

<link rel="stylesheet" href="{{- $bundle.RelPermalink -}}" integrity = "{{$bundle.Data.Integrity}}"/>

I recognize this isn’t stack exchange and most of you guys that have put this together are volunteers, but there isn’t yet a large community of people in other venues up to speed with Hugo, so this is currently the best place to gather info on cases you did not detail in the docs.

Has anyone looked into merging page and global level sass files and feeding them into the processing chain?