Can't evaluate field PostProcess in type interface {} when using snippet from docs

Hi I am trying to use postcss. I use the snippet from the docs.

{{ $css := resources.Get "css/main.css" }}
{{ $css = $css | resources.PostCSS }}
{{ if hugo.IsProduction }}
{{ $css = $css | minify | fingerprint | resources.PostProcess }}
{{ end }}
<link href="{{ $css.RelPermalink }}" rel="stylesheet" />

When I remove resources.PostProcess from the pipe it actually works. Otherwise I get tis error:

PS C:\Users\nico.braun\Documents\Code\portfolio> hugo -e production
Building sites … ERROR 2020/04/30 23:42:43 render of "taxonomyTerm" failed: "C:\Users\nico.braun\Documents\Code\portfolio\layouts\_default\baseof.html:11:44": execute of template failed: template: _default/list.html:11:44: executing "_default/list.html" at <resources>: can't evaluate field PostProcess in type interface {}
ERROR 2020/04/30 23:42:43 render of "taxonomyTerm" failed: "C:\Users\nico.braun\Documents\Code\portfolio\layouts\_default\baseof.html:11:44": execute of template failed: template: _default/list.html:11:44: executing "_default/list.html" at <resources>: can't evaluate field PostProcess in type interface {}
Total in 23 ms
Error: Error building site: failed to render pages: render of "home" failed: "C:\Users\nico.braun\Documents\Code\portfolio\layouts\_default\baseof.html:11:44": execute of template failed: template: _default/list.html:11:44: executing "_default/list.html" at <resources>: can't evaluate field PostProcess in type interface {}
PS C:\Users\nico.braun\Documents\Code\portfolio>

I am not sure If this might be because I only have a baseof and a list template so far. On the other hand, I dont see a good reason why it shouldn’t work with only those templates.

It works when I run hugo server. No issues with the postcss setup there.

check your hugo version - you need to be 0.69 and above for PostProcess to work.

1 Like

I’m seeing this on netlify but not on local installation?

You should look in the Netlify docs about how to set Hugo version.

1 Like