I actually already managed to accomplish my goal, however, I would like to know if I can have the same results in a more elegant (or even more efficient) way.
{{ $css := slice }}
{{ $path := "src/css/mytheme" }}
{{ with readDir (printf "/assets/%s" $path) }}
{{ range . }}
{{ if (eq ( strings.TrimLeft "." (path.Ext .Name) ) "css") }}
{{ $css = $css | append (resources.Get (printf "/%s/%s" $path .Name ) ).Content }}
{{ end }}
{{ end }}
{{ end }}
The first thing to notice is that because resources.Get
already takes into account the /assets
substring I had to split it into a variable as readDir
does not. Then I had to filter manually the extension as no glob pattern is available (afaik). It does the job, but seems… dirty to me.