Readme
can be used to build Single-Page Application (SPA) in Go in different ways:
- Building and enhancing a static HTML website
- Building and embedding Web Components on a stateless website
- Building a full SPA with state and API calls
This example illustrates how to use for building and enhancing a static HTML website:
- uses the go HTML templating package to build page content directly on the front-end.
- generates HTML content from an embedded markdown source, directly on the front-side.
The markdown source includes two components wich are rendered with the icecake markdown extension:
<ick-icecake-brand/>
:
<ick-button/>
:
Build
This example requires a simple build of the wasm code where the source is located in ./examples/example1/wasm/example1.go
To build it run the build_eample
task as follow:
# from the icecake root directory:
EXAMPLE=example1 task -t ./build/Taskfile.yaml build_example
The build will be located in the ./examples/website
ditectory.
Run
Because this is a static webpage, you can serve the ./examples/website
directory with any webserver.
We've setup liveserver
to serve it, see .vscode/settings.json
.
Open localhost:5510/example1.html
URL.