Skip to content

fix: Fix css loading on direct links - #31

Merged
oto-macenauer-absa merged 3 commits into
masterfrom
bugfix/css-loading
Jul 31, 2026
Merged

fix: Fix css loading on direct links#31
oto-macenauer-absa merged 3 commits into
masterfrom
bugfix/css-loading

Conversation

@oto-macenauer-absa

@oto-macenauer-absa oto-macenauer-absa commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements and fixes related to asset handling, CSS layer ordering, and proxy compatibility for the documentation marketplace. The main changes focus on ensuring consistent CSS rendering, correct asset resolution when served from sub-paths, and preventing encoding issues with proxies and gateways.

Asset handling and CSS fixes:

  • In scripts/build-vite.js, the asset copy logic now rewrites root-relative url() references in CSS bundles (e.g., url(/fonts/...)) to relative paths (e.g., url(../fonts/...)). This ensures that CSS assets resolve correctly when the app is served from a sub-path, such as /knowledge-base/{slug}/_astro/.
  • Added writeFileSync import to support the CSS rewriting logic in the build script.

CSS layer ordering:

  • In src/layouts/Base.astro, a fix was added to declare @layer base before sub-app stylesheets are slotted in. This guarantees that Tailwind's base layer has lower priority than Starlight's content layers, ensuring heading sizes and other styles render correctly on both direct page loads and client-side navigation.

Proxy and gateway compatibility:

  • In nginx.conf, the gzip_proxied directive is now set to off to prevent nginx from gzip-encoding responses to proxies or gateways that already sent Accept-Encoding upstream. This avoids issues where the Content-Encoding header could be leaked to the browser, causing decoding errors.
  • Added a Cache-Control: no-transform header for /knowledge-base/ routes in nginx.conf to instruct intermediate proxies (like FragmentGateway) not to transcode or re-encode responses, further preventing encoding mismatches.

Dependency updates:

  • Updated @astrojs/check development dependency from ^0.9.9 to ^0.9.10 in package.json.

Release notes:

  • Fix css loading on direct links

Related:

Closes #30

oto-macenauer-absa and others added 3 commits July 31, 2026 15:12
The lockfile contained 18 `resolved` URLs pointing at the internal
Artifactory mirror (artifacts.bcp.absa.co.za), which broke `npm install`
for anyone off the corporate network. Lockfile URLs take precedence over
the configured registry, so the public registry setting was not enough.

Regenerated the lockfile from scratch; all 485 resolved URLs now point at
registry.npmjs.org.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015MkyFmv3JPCkTaFhPVUFtg
@oto-macenauer-absa
oto-macenauer-absa merged commit 6d11508 into master Jul 31, 2026
5 checks passed
@oto-macenauer-absa
oto-macenauer-absa deleted the bugfix/css-loading branch July 31, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: CSS loading, asset URL rewriting, and nginx encoding errors with proxy gateways

1 participant