Hugo: Warning "you need the extended version to build SCSS/SASS" not triggered when it should

Created on 18 Apr 2020  Â·  3Comments  Â·  Source: gohugoio/hugo

When attempting to transform SCSS with the standard (non-extended) hugo version, a warning is supposed to be printed which informs users that the extended version is required to perform this action. Because of a bug, since 0.67.1 (up to including 0.69.0), this warning only appears if resource caching is disabled in the site config.

How to reproduce

  1. Install any non-extended hugo with version 0.67.1 or higher
  2. Set up basic website with a theme that uses SCSS, for example the noteworthy theme
  3. Remove themes/noteworthy/resources folder
  4. Run hugo server
  5. In 0.67.0 the error message was:
    Building sites … ERROR 2020/04/18 09:41:41 Transformation failed: TOCSS: failed to transform "css/main.scss" (text/x-scss): resource "scss/css/main.scss_48b060fe05b0a273d182ef83c0605941" not found in file cache. Check your Hugo installation; you need the extended version to build SCSS/SASS.
    in all later versions up to 0.69.0 the message only is:
    Building sites … ERROR 2020/04/18 09:37:04 TOCSS: failed to transform "css/main.scss" (text/x-scss): resource "scss/css/main.scss_48b060fe05b0a273d182ef83c0605941" not found in file cache

Cause

The problem is this line:
https://github.com/gohugoio/hugo/blob/2b28e5a9cb79af2a8d70c80036f52bcf5399b9df/resources/transform.go#L422
If resource caching is enabled, the following block with the "you need the extended version" warning is skipped, and the resulting error message is only the generic one.
I'm not a Go person myself, so I would appreciate if someone else could look into fixing this.

I went through a few frustrating hours because of this... :disappointed:

Most helpful comment

I has been suffering from this problem for days, because the documentation did NOT point this out. I suggest updating the documentation here to remind users to use the extended version.

All 3 comments

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

This bug still appears to be present:

installing:

$ snap install hugo
hugo 0.74.3 from Hugo Authors installed

running:

$ hugo
Total in 17 ms
Error: Error building site: TOCSS: failed to transform "scss/style.scss" (text/x-scss): resource "scss/scss/style.scss_b95b077eb505d5c0aff8055eaced30ad" not found in file cache

whereas installing:

$ snap install hugo --channel=extended
hugo (extended/stable) 0.74.3 from Hugo Authors installed

works correctly

I has been suffering from this problem for days, because the documentation did NOT point this out. I suggest updating the documentation here to remind users to use the extended version.

Was this page helpful?
0 / 5 - 0 ratings