Vugu: Experimental library for web UIs written in Go and targeting WebAssembly
github.com
github.com
It's basically a go-generate-time tool that parses a .vugu file similar to a vue file but the expressions in it are Go code. It spits out a big function that, when run, produces the resulting virtual DOM - with conditionals, loops, etc.
Some tooling helps with this so you can rebuild automatically on page load and so forth, but the above is the basic idea. Curious what people think.
If I can make a suggestion, though, the "root.vugu" code snippet from step 3 on the Getting Started page should be one of the first things in README.md and on the vugu.org page. It gets the core idea across right away, just like the code editor at the top of golang.org quickly shows what the language is like.
Depending on use case, WebAssembly might even be an alternative to Java on servers. Go already supports cross platform compilations, so the use case for Go on WebAssembly on a server isn't as obvious. At least, not for those of us who value simplicity or performance. On the other hand, most of us didn't see Javascript on servers coming either, so I wouldn't rule it out.
Love it already
I've been enjoying the process, so this subject interests me but I'm running into a long series of errors when starting the tutorial dev server.
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:23:16: undefined: js.Func
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:28:15: undefined: js.FuncOf
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:107:34: js.Global().Get("document").Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:152:19: mountParentEl.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:165:16: mountChild1.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:309:8: n.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:680:8: el.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:759:19: oldKeyJSVal.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:810:7: v.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:813:51: firstChild.Truthy undefined (type js.Value has no field or method Truthy)
github.com/vugu/vugu@v0.0.0-20190329041623-36c2913f3f3c/env-js.go:813:51: too many errors
Have any insight?The syscall/js API is still in development and undergoing API changes. It’s not stable like the rest of Go’s standard library.
edit: Updatd to 1.12—no dice. Many of the errors did go the way of the buffalo, but a couple remain:
2019/03/29 11:08:37 Error from compile: exit status 2 (out path="/var/folders/lp/d1rds9q57wqdmgchmzjjrh3hfsm71q/T/main_wasm_237110380"); Output:
# example.com/test/testapp
./root.go:11:13: undefined: RotData
./root.go:37:30: data.Toggle undefined (type *RootData has no field or method Toggle)
./root.go:47:8: data.Toggle undefined (type *RootData has no field or method Toggle)https://www.youtube.com/watch?v=0RfUPr0KrSM&t=836s
I didn't try it yet, but it looks very promising and I hope I will be able to use C# or F# for client side programming, because it's hard to master a new JS framework every 3 months or so and I already have JS fatigue.
The doc site is a prototype and proof-of-concept using Vugu. First attempt, just wrote it last week. Lots of optimizations still needed for sure.