Skip to content

Repair HTMX symlink in Docker builds - #6

Open
jhunterjActual wants to merge 1 commit into
GrandComicsDatabase:mainfrom
jhunterjActual:fix/windows-htmx-symlink
Open

Repair HTMX symlink in Docker builds#6
jhunterjActual wants to merge 1 commit into
GrandComicsDatabase:mainfrom
jhunterjActual:fix/windows-htmx-symlink

Conversation

@jhunterjActual

Copy link
Copy Markdown
Contributor

Summary

static/js/htmx.min.js is a Git symbolic link to the versioned HTMX asset. On Windows checkouts where Git symlink support is disabled, it is materialized as a regular text file containing only the target filename.

Docker previously copied that text file into the Linux image. Browsers then attempted to execute htmx_2_0_8.min.js as a JavaScript identifier and reported:

Uncaught ReferenceError: htmx_2_0_8 is not defined

Recreate the symbolic link inside the Linux image after copying the Django source. This produces the expected result regardless of how the Windows host checked out the Git symlink.

Testing

  • Built the web image successfully with Docker Compose.
  • Confirmed inside a disposable container that htmx.min.js is a symbolic link to htmx_2_0_8.min.js.
  • Confirmed that reading the link returns the actual HTMX JavaScript, beginning with var htmx=function(){.
  • Confirmed locally that the browser no longer reports the HTMX reference error.
  • Docker Compose validation and git diff --check pass.

Comment thread Dockerfile
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