Why PostCSS has to be installed globally?

According to the docs it is mandatory to install PostCSS globally.

So each time someone clones a Hugo project that uses PostCSS, one can’t just npm i but has to npm i -g PostCSS and so on for each PostCSS plugins (and the same for CI/deploy tool)? Is it planned to stay like this?

It works for me if I declare postcss-cli within devDependencies/dependencies. Just try it :slight_smile:

Well I don’t understand: I uninstalled PostCSS both globally and locally, and Hugo doesn’t throw any error when I use resources.PostCSS, as it did just before installing them globally for the first time… What kind of wizardry is happening here?

Hugo probably takes the generated CSS files from the folder /resources/.

If you delete this folder you get the expected error message.

I can confirm that I need to install postCSS globally. A few months ago installing postCSS in the project folder worked.

1 Like

you were right @Grob, thanks!

@holehan it doesn’t for me…

I just tested https://github.com/budparr/hugopipes-tailwindcss (not my repo, but one that uses Hugo Pipes with postcss) which installs postcss-cli locally. On both a mac and a linux machine it just works™. Are you on Windows by any chance?

1 Like

Yes, I’m on Windows by any chance, of course ^^

Just to correct myself: postCSS in the Hugo project folder is working again (MacOS). There probably was a issue with an earlier version of Hugo. Anyway—I could uninstall the global npm packages.

Ok, I mentioned this inconsistency here, thanks for the feedback.