bnjmnrsh-projs / signal-v-noise

Code kata using the NYT API.
https://bnjmnrsh-projs.github.io/signal-v-noise/
1 stars 0 forks source link

404 wont load styles on some routes #37

Open bnjmnrsh opened 10 months ago

bnjmnrsh commented 10 months ago

Our router and code seems to work correctly when an unknown ?section=taco query is passed, and it also falls back gracefully to the GH Pages 404.index when the route is one layer deep, i.e. https://bnjmnrsh-projs.github.io/signal-v-noise/tacos

However, if an unknown route is passed, that is more than one layer deep, i.e. https://bnjmnrsh-projs.github.io/signal-v-noise/some/tacos/, the 404-page loads, but the styles do not.

This may, in part, be because the site is in a sub-directory of the https://github.com/bnjmnrsh-projs/ namespace.

Regardless, we are using relative URLs for css, etc., and a fully qualified URL is needed instead. Because Parcel generates these assets dynamically at build time, we will have to explore how this can be achieved.

This is really an edge case, and given the goal of moving to Vite, it may need to be revisited after that work has been done.

Screenshot 2024-01-09 at 15 18 08 Screenshot 2024-01-09 at 15 17 54

bnjmnrsh commented 10 months ago

Another option may be to inline the critical styles.

https://github.com/parcel-bundler/parcel/discussions/5263 https://parceljs.org/languages/html/#inline-scripts-and-styles https://parceljs.org/features/bundle-inlining/