I’m using css files in each content folder to insert styles in the head of pages, working as desired here: https://discourse.gohugo.io/t/is-this-the-proper-way-to-read-reference-a-file-located-in-the-current-content-directory-from-a-partial
{{- if .Params.custom_css }}
<style>{{ (.Resources.GetMatch "index.css").Content | safeCSS }}</style>
{{- end }}
I don’t want these files to be transferred over during builds, since they are not linked/used by any page. I thought initially ignoreFiles would do the trick, but it seems to exclude the file FROM the build. So, this setting:
ignoreFiles = [“index.css$”]
Triggers the following error:
Error: Error building site: failed to render pages: render of “home” failed: execute of template failed: template: index.html:3:7: executing “index.html” at <partial “head.html” .>: error calling partial: “C:\Hugo\Sites\powerspreaders\themes\twstarter\layouts\partials\head.html:27:35”: execute of template failed: template: partials/head.html:27:35: executing “partials/head.html” at <“index.css”>: nil pointer evaluating resource.Resource.Content
It seems ignoreFiles does just that, it doesn’t allow the build to use the index.css files. I want the build to use the files BUT not transfer them over to the build. Is that possible?