Skip to content

E0151: Markup outside a .vuka.html file ​

Markup is written in .vuka.html files, and only there: a .vuka.html file declares one struct in its <script lang="go"> and its markup below renders it. .vuka and .go files are logic — services, models, helpers, main — and hold no markup. A .vuka.html file's script holds none either: its markup follows </script>.

The compiler still lowers markup the way it lowered JSX in a .vuka file; it is the place it is written that is one. A function that returned markup becomes a component: a .vuka.html file whose struct's exported fields are the function's parameters, used as a tag.

Wrong ​

vuka
// card.vuka
package components

type Card struct {
	Title string
}

func (c Card) View() ui.Node {
	return <h2>{c.Title}</h2>
}
html
<!-- card.vuka.html -->
<script lang="go">
package components

type Card struct {
	Title string
}
</script>

<h2>{Title}</h2>

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.