HUGO

Problems getting started with Hugo Pipes to process SCSS

I’m trying to convert my SCSS processing over to use the resources.ToCSS rather than having to rely on external tools. I’m using Hugo v0.74.3 that has been built with the extended options so it should have support for Sass/Scss processing, but yet TOCSS fails with a “resource not found in file cache” error.

In my template where I’m making the call to process my scss files I have the following:

{{ $style := resources.Get "scss/overrides.scss" | toCSS }}
<link rel="stylesheet" href="{{ $style.Permalink }}">

and my SCSS files are under assets/scss/ but when I hugo serve it errors with the following:

Error: Error building site: TOCSS: failed to transform "scss/overrides.scss" (text/x-scss): resource "scss/scss/overrides.scss_f300667da4f5b5f84e1a9e0702b2fdde" not found in file cache

The environment I’m using is as follows:

Hugo Static Site Generator v0.74.3 freebsd/amd64 BuildDate: unknown
GOOS=“freebsd”
GOARCH=“amd64”
GOVERSION=“go1.14.6”

Direct link to my template file: https://gitlab.com/vendion/vendion.me/-/blob/hugo-pipes/layouts/partials/head.html
Assets: https://gitlab.com/vendion/vendion.me/-/tree/hugo-pipes/assets/scss

This indicates that you are using the none extended version.

It should say something like Hugo Static Site Generator v0.74.3/extended …

That is probably an issue with the FreeBSD port, but according to the Makefile for the port the extended options are built by default. The “EXTENDED” flag in the Makefile, which is enabled by default, means that Hugo gets built with the following CGO_ENABLED=1 BUILD_TAGS="-tags extended" i.e. CGO_ENABLED=1 go build --tags extended which seems to match was is listed in the official Hugo README for building Hugo with the extended options

Okay, I was able to confirm that this is an issue with the FreeBSD port of Hugo and reported it to the port maintainer.

In the meantime I built Hugo from source with the extended flag and everything is working as expected.