ToCSS Will Not Work No Matter What I Do

I have tried everything I can think of and looked everywhere but I cannot get a solution or even information about this problem. I get the following error when trying to us Hugo Pipes to transpile SCSS.

executing "partials/header.html" at <resources.ToCSS>: error calling ToCSS: type <nil> not supported in Resource transformations

I am using the extended version of Hugo and all of my files are in the right place. Lines of code from header.html are as follows.

{{ $options := (dict "targetPath" "css/styles.css" "enableSourceMap" true )}}
{{ $scss := resources.Get "scss/main.scss" }}
{{ if $scss }}
	{{ $styles := $scss | resources.ToCSS $options }}
	<link rel="stylesheet" href="{{ $styles.Permalink }}">
{{ end }}

I found this issue thread on the the Hugo Github but @bep’s solution really did not address the issue. Regardless, it is being implemented in the above code, however, it still fails to find my scss file.

Below is a screenshot of my file tree to show where the ‘main.scss’ file is located.

header.html — hugo (Workspace) 2021-10-06 10-15-57

All documentation and resources tell me this is correct. If this is an issue with the resource not being found, therefore returning as <nil>, and the resource is in the correct place. What is going on?

Can anyone provide some clarity about what is happening and why I am unable to use this feature even though I am on the correct version?

Here is my output when running ‘hugo version’:

hugo v0.88.1+extended darwin/amd64 BuildDate=unknown

I do not know what else to do other than use Gulp to build my assets which I am trying to avoid. Thank you all in advance for your time.

It looks like you have placed the assets/ directory within the resources/ directory.

Don’t do that.

https://gohugo.io/getting-started/directory-structure

1 Like

THANK YOU @jmooring! It would have taken me quite a long time to figure that out.

1 Like

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