Difference between postCSS and resources.PostCSS

Hm. In Cloudflare Pages,I’m using the following build configuration, directly adapted from the one suggested for Netlify here:

npm install sass-embedded-linux-x64@${DART_SASS_VERSION} && mkdir -p /opt/build/repo/node_modules/.bin &&  cp -r /opt/build/repo/node_modules/sass-embedded-linux-x64/dart-sass-embedded/* /opt/build/repo/node_modules/.bin/ && dart-sass-embedded --version &&  hugo --gc --minify

with the following environment variables set:

DART_SASS_VERSION = 1.57.1
HUGO_VERSION = 0.112.5
NODE_VERSION = v14.19.0

The build fails when running this command:

mkdir -p /opt/build/repo/node_modules/.bin

with the following error message:

mkdir: cannot create directory ‘/opt/build/repo’: Permission denied

I’ve uploaded the complete build log here: shared.via.dj – donaldjenkins.8c68d5cd-c2d4-416e-9183-ef44f2169adb.log (10 KB).

According to this discussion page, the Cloudflare Pages build script can write to nonexistent files but only if the folder structure already exists. If that’s not the case, the commenter continues, ‘the following code can create the required folder(s):’

if (!fs.existsSync(path.replace("/index.html", ""))){
      fs.mkdirSync(path.replace("/index.html", ""), { recursive: true });
    }

I’m going to try and research this further with Cloudflare as their documentation is silent on the subject, but in the mean time any suggestions would of course be welcome.

I did find this, and a sequel, which includes a script for gatting dart-saas working with Hugo on Cloudflare Pages. I’ll be trying that out as well.