Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.04 KB

README.md

File metadata and controls

53 lines (34 loc) · 1.04 KB

:q

hexed

Deploy Pages

preview

Build

  • First, compile Go code to WebAssembly:

    GOOS=js GOARCH=wasm go build -o main.wasm main.go
  • Copy the WebAssembly JavaScript support file from local Go installation:

    cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" .
    # or
    cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .

    See https://go.dev/wiki/WebAssembly guide.

  • Final directory structure should look like:

    app/
    ├── index.html
    ├── main.wasm
    └── wasm_exec.js
  • Push these files to GitHub/GitLab and enable Pages.

Develop

find -name '*go' -or -name '*.html' -or -name '*.js' | entr -crs "GOOS=js GOARCH=wasm go build -o main.wasm main.go; python -m http.server"

Thanks

Related