CorrelAid / correlaid_website

Source code for the CorrelAid website
https://correlaid.org
3 stars 0 forks source link

505 static build should include all assets #620

Closed jstet closed 4 months ago

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **correlaid** | ⬜️ Ignored ([Inspect](https://vercel.com/correlaid/correlaid/6bLHt3YfdGUmfRD6AaB794tn21rP)) | [Visit Preview](https://correlaid-git-505-static-build-should-include-4e0ded-correlaid.vercel.app) | | Dec 14, 2023 3:49am |
cloudflare-pages[bot] commented 5 months ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9638b34
Status: ✅  Deploy successful!
Preview URL: https://90d7c7ef.correlaid.pages.dev
Branch Preview URL: https://505-static-build-should-incl.correlaid.pages.dev

View logs

jstet commented 5 months ago

@KonradUdoHannes @friep does this approach (npm postbuild script) make sense to you?

jstet commented 5 months ago

This only includes image so far, need to implement it for pdfs as well

KonradUdoHannes commented 4 months ago

If I understand it correctly this approach calls npm run postbuild after we've run build and it then adds the images to the build directory. I think for building itself this is a valid approach. I would even say that eventually we would not want to build in any different way anymore, such that I would suggest to include it in build itself instead of having a postbuild script. That way build would simply axecute vite build and our script. The script could then be called similar to its filename reflecting what it does rather then its intention to be run after the build command. Another benefit of this approach is, that other scripts like build-and-test would doe the full build including images.

One thing I'm not sure about is the following. How ist all this handled for local deployments for interactive development? I would guess that the page would also be looking for images on localhost then, so we would have to make sure they are also there. Can this be done with the same script but a different target directory or is there a different approach. Since I havn't tried running the branch I'm not 100% sure this will be an issue. Intuitively I would say if we are modifying build and change the page source code accordingly , we also have to modify dev, so they fit together.

jstet commented 4 months ago

The postbuild script is automatically run after npm build, so we dont need to run it or add it manually.

npm run dev is not affected as it does not serve the build directory.