Hi hugo community, quite confused about some basic SCSS setup.
I am running:
Hugo Static Site Generator v0.80.0/extended darwin/amd64 BuildDate: unknown
According to the docs:
Asset files must be stored in the asset directory. This is
/assets
by default, but can be configured via the configuration file’sassetDir
key.
I have not set up an assetDir key in config.toml, such that I can use the default path.
And so I structured my directories as such:
(NOTE: I understand that style.scss is not in the correct location, we’ll come to that in a moment)
main.scss is.
Later in the Pipes Introduction
section (and in the SASS/SCSS section, but long hand):
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
I only used the ToCSS pipe which produces these errors:
execute of template failed: template: index.html:9:59: executing "index.html" at <resources.ToCSS>: error calling ToCSS: type <nil> not supported in Resource transformations
I also attempted to use the includes path
taking into account that
Paths must be relative to the project
like this:
<!-- Custom stylesheets-->
{{ $options := (dict "includePaths" (slice "/css/style.scss")) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
This results in a different error:
error calling ToCSS: no Resource provided in transformation
Not sure why there was no provided resource, or how exactly that’s different from a <nil>
resource?
I added .Site.BaseURL
to the path above, same error.
Sorry if I’m missing something dead obvious, but what have I done incorrectly in setting up the SCSS?
Thanks all.