Moving files post-build for Svelte app in Cloudflare Pages


I have a Svelte build that is deployed to Pages via GitHub, and then build using “npm run build” and deployed from directory “/build”.

There is a postbuild script which purges and minifies CSS, here:

postbuild": "npx purgecss --css $(pwd)/build/css/*.css --content $(pwd)/build/**/*.html $(pwd)/build/**/*.js --output $(pwd)/build/css && npx css-minify -d build/css -o build/css && mv $(pwd)/build/css/main.min.css $(pwd)/build/main.css"

When I run this locally on my machine, as expected the .css files are replaced with the new purged, then minified versions. But on Cloudflare it basically just breaks all the CSS of the page.

Is there a trick to this type of postbuild activity?


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