I went through the topics but even if similar error occour previously, the proposed solutions didn’t work in my case.
The code below works fine as long I don’t pass $toCssOptions to resources.ToCSS filter. When I run it via hugo server I get Error: Error building site: POSTCSS: failed to transform "scss/style.css" (text/css): resource "scss/css/style.scss_df6f7a8f87659d1116ec85e6c1766534" not found in file cache
Error: Error building site: POSTCSS: failed to transform "css/style.css" (text/css): resource "scss/css/style.scss_4853eb546e7a6c0898ed71feae7357c0" not found in file cache
git clone --recurse-submodules git@github.com:Appdy/site.git
cd site
hugo
Error: Error building site: POSTCSS: failed to transform “css/style.css” (text/css): resource “scss/css/style.scss_432e8a83de7c44f3fe0cc7ac93f1ed8d” not found in file cache
npm init -y
npm install -D postcss postcss-cli autoprefixer
hugo
Error: Error building site: POSTCSS: failed to transform “css/style.css” (text/css): ReferenceError: purgecss is not defined
npm install -D @fullhuman/postcss-purgecss
hugo
Error: Error building site: POSTCSS: failed to transform “css/style.css” (text/css): ReferenceError: purgecss is not defined
Last step, add the following line to the top of postcss.config.js:
ps. I think it should be added automatically as an option when we generate new project. Many people has this issue, something like --with-postcss would prevent many problems.