All Projects → syumai → go-hyperscript

syumai / go-hyperscript

Licence: MIT license
hyperscript implementation in Go.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].