Fix Pages: relative asset paths in public/index.html#3
Merged
Conversation
The Pages site at https://avanelsas.github.io/bareforge/ was loading the editor HTML but the bundled JS never executed — `<script src="/js/main.js">` is absolute, so the browser resolved it against the user-pages root (avanelsas.github.io/js/main.js → 404) instead of the project sub-path (avanelsas.github.io/bareforge/js/main.js, where the file actually lives). Changing the script src + favicon href to relative paths (`js/main.js`, `favicon.svg`) makes the same artefact serve correctly under both the dev server's `/` root and the project-pages sub-path. Pairs with the earlier shadow-cljs.edn :asset-path 'js' (relative) change which fixed only the cljs-side lazy-loaded modules, not the static <script> tag. Local gates green: 486 tests / 0 release warnings / clj-kondo clean / cljfmt clean.
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.
Summary
The Pages site at https://avanelsas.github.io/bareforge/ serves the editor HTML correctly, but the JS bundle never executes —
<script src=\"/js/main.js\">is absolute, so the browser resolves it against the user-pages root (avanelsas.github.io/js/main.js→ 404) instead of the project sub-path (avanelsas.github.io/bareforge/js/main.js, where the file actually lives).Changing the script src + favicon href to relative paths (
js/main.js,favicon.svg) makes the same artefact serve correctly under both the dev server's/root and the project-pages sub-path.Why this slipped through
Pairs with the earlier
shadow-cljs.edn:asset-path \"js\"(relative) change. That fixed only the cljs-side lazy-loaded modules and not the static<script>tag inpublic/index.html— which is why the Pages deploy ran clean (the artefact uploaded fine) but the deployed app rendered empty.Test plan
gh workflow run pages.ymlto redeploy. Thencurl -s https://avanelsas.github.io/bareforge/ | grep src=should showsrc=\"js/main.js\"and the editor should actually render in a browser.