Skip to content
hyperscript implementation in Go.
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dom
examples
hyperscript
.gitignore
LICENSE.md
Makefile
README.md

README.md

go-hyperscript

  • Simple hyperscript like script implemented in Go.
  • You can use this package in these ways:
    • Write HTML using Go function.
    • Update existing DOM based on previous VNode tree.

Usage

Write HTML using Go function

func main() {
	node := h.H("div", nil,
		h.H("h1", nil, h.Text("Example App")),
		h.H("strong", nil,
			h.H("font", h.Object{"color": "red"}, h.Text("Hello, world!")),
		),
		...
	)
	body := js.Global().Get("document").Get("body")
	dom.NewRenderer().Render(node, body)
}

Example

Update DOM

  • Now go-hyperscript provides basic support for reusing and updating existing DOM.
  • To use this function, please render multiple times using same renderer.

Examples

Environment

  • go 1.13

Development

make build
make test

Author

syumai

License

MIT

You can’t perform that action at this time.