This feature is not available in your current Hugo version

Hi,

Firstly great news with Hugo Pipes and support for SASS.

I have downloaded the latest Windows extended version (hugo_extended_0.43_Windows-64bit.zip) of Hugo to test implementing SASS. If I run “hugo env” I see the following:

Hugo Static Site Generator v0.44-DEV/extended windows/amd64 BuildDate: unknown
GOOS=“windows”
GOARCH=“amd64”
GOVERSION=“go1.10.3”

However if I create a new site, add the ananke theme and create a scss file:

\themes\ananke\assets\scss\main.scss

I get the following serve error:

Building sites … ERROR 2018/07/10 12:18:21 error: failed to transform resource: failed to transform “scss/main.css” (text/css): this feature is not available in your current Hugo version

Am I doing something wrong? I thought the latest extended version had scss support.

Did you use

{{ $styles := resources.Get "scss/main.scss" | toCSS | postCSS | minify | fingerprint }}

Same happened to me. If you take postCSS away it worked for me. Don’t know the reason yet

You guys need to npm install both postcss-cli and whatever PostCSS plugin(s) your are listing in you postcss.config.js file.

Contrary to ToCSS, PostCSS is “node” dependent.

1 Like

Thanks Regis. I have run:

npm install -g postcss-cli

in the root of my test site and it now builds. :grinning:

Might be worth adding this to the pipes news article for anyone starting out with Hugo.

Agree, please add it, @mattjones. :slight_smile:

Yes, for example:

> npm install -g postcss-cli
> npm install -g autoprefixer
1 Like

Just noting for anyone who finds this issue in the future that it’s no longer required to install postcss-cli with the global flag (npm install -g postcss-cli); it can be installed locally to your project as of Hugo 0.45

3 Likes

Whereabouts? For example, I have an assets/scripts/ directory that has my package.json since I am still using Webpack 4 for AMD. Will Hugo find postcss-cli if I add this to my devDependencies at assets/scripts/package.json or are you installing postcss-cli at the root of the project, @budparr?

Instead of

npm install -g postcss-cli

it’s

npm install -D postcss-cli

(note, the -D flag is optional, I’m assuming you’ll want to install is at a dev dependency)

1 Like

@budparr, Oops. I should have been clearer. I’m wondering if I install postcss-cli deeper inside the project rather than at the root (i.e. since my package.json and node_modules are at <project>/assets/scripts/package.json rather than <project>/package.json) if Hugo is smart enough to look for the local installation at multiple levels. I’m pretty familiar with the -D flag :smile: That said, I should probably just test this myself!

1 Like

Hello.

I think i have the same issue. With HUGO v0.46. Am i doing something wrong ?

$ hugo -w serve
Building sites … ERROR 2018/08/02 00:27:05 error: failed to transform resource: TOCSS: failed to transform "scss/orbit-6.scss" (text/x-scss): this feature is not available in your current Hugo version

And in my head.html (in a theme) i just have :

{{ $style := resources.Get "scss/orbit-6.scss" | toCSS }} 
<link id="theme-style" rel="stylesheet" href="{{ $style.Permalink }}">

Of course the file “themes/<my_theme>/assets/scss/” is available on path. I have a few imports in this file, is the problem with the path of these imports ? (if yes, maybe the error message is misleading).

// Import theme styles
@import "theme/mixins";
@import "theme/base";
@import "theme/responsive";

You need the Hugo Extended version installed. If you run hugo version it should contain the string “extended”:

Hugo Static Site Generator v0.46-DEV-B5D13CA16/extended darwin/amd64 BuildDate: 2018-08-01T09:45:10+0200
1 Like

Thanks for the quick answer. Wasn’t aware of this “extended” version. Can confirm that it’s working now with that one :wink:

1 Like

I’m sorry, but resources.PostCSS is not building for me unless I install postcss-cli globally. What?

@numbfall| hat is the output of hugo version?

Also, you need to remember that it is the same people who get notified about GitHub issues and posts in here, so double posting isn’t as effective as one would think.

Sorry for the double post. Here is the exact output of hugo version

Hugo Static Site Generator v0.46 windows/amd64 BuildDate: 2018-08-01T09:01:27Z

I tried to deploy on Netlify with the same version and it worked there!.

One interesting thing to note. If I have the resources pre-built by the global postcss-cli. hugo does not error. However it does not register any changes I make in the css after that either.

It could be a windows path issue. I doubt that, but I have not tested this particular case on Windows. Maybe others can chime in.

I’ve tested this on windows cmd and Hugo only detects PostCSS when installed globally. With Git Bash it does not detect neither the global or local install of PostCSS.

Edit: Git Bash DOES detect the global install of PostCSS too.

2 posts were split to a new topic: Error on quick start