gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.83k stars 7.47k forks source link

PostCSS with custom tailwind.config.js does not work with the -s flag #7287

Open bep opened 4 years ago

bep commented 4 years ago

What version of Hugo are you using (hugo version)?

$ hugo version

Does this issue reproduce with the latest release?

davidejones commented 3 years ago

I just had a similar issue using postcss and csspurge. Site structure like this

/node_modules/
/src/
  assets/
  config/
  content/
  layouts/
  postcss.config.js
package.json

Running the command hugo -s src on windows worked fine but I was banging my head against a wall running the same command during a linux github action where it was failing every time with

Error: Error building site: POSTCSS: failed to transform "style.css" (text/css): resource "css/css/bundle.css_b1dae1e6a06c812cd4bcab1cb0e84658" not found in file cache

It was the same files, same node version, same hugo version with the exception of being linux. I found switching to a bash prompt (MINGW64) on windows I could recreate the issue. As a quick fix I copied the /node_modules/ to the src/ dir and it worked fine again both in the action and bash.

I'm wondering if the code here should lookup project node_modules then node_modules inside current working dir when running hugo binary and then fallback to the cache like it does now?

bep commented 3 years ago

I'm wondering if the code here should lookup project node_modules

My memory is a little shady, but I don't think the (primary) problem is finding the binary. This is an issue even if you install PostCSS CLI globally,

lucperkins commented 1 year ago

I recently got bit by this as well. I'm trying to use a theme to build multiple different sites and I've had to simply not use Hugo for this project because it can't discover postcss-cli no matter what I do.