Skip to content

ndg-html: link custom scripts where they are copied - #298

Merged
NotAShelf merged 1 commit into
feel-co:mainfrom
KiaraGrouwstra:fix-script-paths
Oct 4, 2026
Merged

NotAShelf merged 1 commit into
feel-co:mainfrom
KiaraGrouwstra:fix-script-paths

Conversation

@KiaraGrouwstra

Copy link
Copy Markdown
Contributor

copy_script_files copies each script in script_paths to assets/<file name>. But generate_custom_scripts linked the configured source path, with the root prefix in front. A script from outside the output directory, such as /nix/store/<hash>-scripts/custom.js, then got a link that does not resolve, so the script did not load.

This change links {root_prefix}assets/<file name>, the same name that copy_script_files uses.

  • Adds crates/ndg-html/tests/custom_scripts.rs. It fails before the change and passes after.
  • Adds an entry under "Fixed" in CHANGELOG.md.

We found this when we added Mermaid diagrams to a site built with ndg: we give a small loader script through script_paths.

Assisted-by: Claude:claude-opus-5-5

https://claude.ai/code/session_01RJvbghuj5GtCBiCjmBepNJ

`copy_script_files` copies each script in `script_paths` to
`assets/<file name>`, but the page linked the configured source path. A
script from outside the output directory, such as a path in the Nix store,
did not load. Link `assets/<file name>` instead.

Assisted-by: Claude:claude-opus-5-5
Claude-Session: https://claude.ai/code/session_01RJvbghuj5GtCBiCjmBepNJ

@NotAShelf NotAShelf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you :)

@NotAShelf
NotAShelf merged commit e9dc663 into feel-co:main Oct 4, 2026
12 of 15 checks passed
@KiaraGrouwstra
KiaraGrouwstra deleted the fix-script-paths branch October 4, 2026 10:40
NotAShelf added a commit that referenced this pull request Oct 4, 2026
…ying

Followup for #298

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I44546890ee0af5986ee2c7cd871a64be6a6a6964
NotAShelf added a commit that referenced this pull request Oct 4, 2026
…ying

Followup for #298

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I44546890ee0af5986ee2c7cd871a64be6a6a6964
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.

2 participants