fix: Fix css loading on direct links - #31
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
scripts/build-vite.js, the asset copy logic now rewrites root-relativeurl()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/.writeFileSyncimport to support the CSS rewriting logic in the build script.CSS layer ordering:
src/layouts/Base.astro, a fix was added to declare@layer basebefore 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:
nginx.conf, thegzip_proxieddirective is now set tooffto prevent nginx from gzip-encoding responses to proxies or gateways that already sentAccept-Encodingupstream. This avoids issues where theContent-Encodingheader could be leaked to the browser, causing decoding errors.Cache-Control: no-transformheader for/knowledge-base/routes innginx.confto instruct intermediate proxies (like FragmentGateway) not to transcode or re-encode responses, further preventing encoding mismatches.Dependency updates:
@astrojs/checkdevelopment dependency from^0.9.9to^0.9.10inpackage.json.Release notes:
Related:
Closes #30