Forestry.io Preview Server - Error building site: POSTCSS: failed to transform "css/style.css"

I was sure I had corrected this a number of weeks ago as I know encountered it before and was able to get the preview eventually working.
I will review my commit history to see if there is anything there but I was wondering if anyone has any insight into this.

Just to confirm the site builds perfectly locally and on Netlify but it won’t build in Forestry’s preview. The only difference I can see is Forestry has a HUGO_ENV = staging but everything else seems to be the same.

I get the following message:
“Installing Hugo 0.80.0
Start building sites …
Built in 364 ms
Error: Error building site: POSTCSS: failed to transform “css/style.css” (text/css). Check your PostCSS installation; install with “npm install postcss-cli”. See PostCSS | Hugo”"

css/style.css (Tailwind compiles and css imports work both locally and on Netlify)

    @tailwind base;
    @tailwind components;
    @tailwind utilities;

    @import 'partials/general.css';
    @import 'partials/colors.css';
    @import 'partials/modal.css';
    @import 'partials/buttons.css';
    @import 'partials/filter.css';
    @import 'partials/projects.css';
    @import 'partials/single.css';
    @import 'partials/animations.css';

snippet from the head.html partial

{{ "<!-- CSS stylesheet -->" | safeHTML }}
{{- $options := dict "inlineImports" true -}}
{{- $styles := resources.Get "css/style.css" | resources.PostCSS ($options) -}}
{{ if hugo.IsProduction }}
{{ $styles = $styles | minify | fingerprint | resources.PostProcess }}
{{ end }}
<link rel="stylesheet" type="text/css" href="{{ $styles.RelPermalink }}" />

Thank you

https://forestry.io/docs/faqs/hugo-version/

If your Hugo site relies on postCSS, pick up the Hugo + Node image from the preview settings.

1 Like

Super. Yeah it needed an npm install added to the “preview build” command settings.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.