Skip to content
Vugu: A modern UI library for Go+WebAssembly (experimental)
Branch: master
Clone or download
Latest commit 0a722f1 Apr 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Create question.md Mar 30, 2019
cmd Goimports (#2) Apr 7, 2019
distutil
examples/fetch-and-display removed old wip stuff; removed DevHTTPServer (replaced by simplehttp … Mar 28, 2019
internal/htmlx
simplehttp moved polyfill inside if wasmSupported block Mar 31, 2019
vugufmt Goimports (#2) Apr 7, 2019
.gitignore removed old wip stuff; removed DevHTTPServer (replaced by simplehttp … Mar 28, 2019
.travis.yml
LICENSE Initial commit Mar 20, 2019
README.md added slack link Apr 24, 2019
component.go more doc Mar 29, 2019
component_test.go
data-hasher.go more doc Mar 29, 2019
data-hasher_test.go more doc Mar 29, 2019
doc.go comments Mar 29, 2019
env-js-stub.go more documentation, stub JSEnv for doc Mar 29, 2019
env-js.go
env-static-html.go more documentation, stub JSEnv for doc Mar 29, 2019
env-static-html_test.go
env.go more documentation, stub JSEnv for doc Mar 29, 2019
events-component.go events doc Mar 29, 2019
events-dom.go events doc Mar 29, 2019
events-dom_dummy.go events doc Mar 29, 2019
events-dom_wasm.go basic working event loop and locking model so it's clear who can read… Mar 24, 2019
go.mod Goimports (#2) Apr 7, 2019
go.sum Goimports (#2) Apr 7, 2019
parser-go-pkg.go more doc Mar 29, 2019
parser-go-pkg_test.go moving toward js dom sync support and dev env - .vugu file package st… Mar 23, 2019
parser-go.go always close write pipe; include err in message in a couple gofmt fai… Mar 30, 2019
parser-go_test.go fix typoes Apr 7, 2019
parser.go basic dom events working Mar 24, 2019
vgnode.go more doc Mar 29, 2019
vgnode_test.go some initial prototype stuff starting to come together - parses templ… Mar 21, 2019

README.md

Vugu

Go Report Card Travis CI GoDoc stability-experimental

Vugu is an experimental library for web UIs written in Go and targeting webassembly. Guide and docs at https://www.vugu.org. Godoc at https://godoc.org/github.com/vugu/vugu.

If you've ever wanted to write a UI not in JS but pure Go... and run it in your browser, right now... That (experimental;) future is here!

Introducing Vugu (pronounced /ˈvuː.ɡuː/), a VueJS-inspired library in Go targeting wasm.

No node. No JS. No npm. No node_modules folder competing with your music library for disk space.

Updates ♨

  • 2019-04-07 The Vugu Playground is up at: https://play.vugu.org/
  • 2019-04-05 Thanks to @erinpentecost, vugufmt is now available and provides gofmt-like functionality on your .vugu files. ("go get github.com/vugu/vugu/cmd/vugufmt && go install github.com/vugu/vugu/cmd/vugufmt")
  • 2019-04-05 The component playground should be available soon; followed by some internal work to properly handle nested components in a type-safe way; then probably a router...

Join the conversation: Gophers on Slack, channel #vugu

Highlights

  • Runs in-browser using WebAssembly
  • Single-file components
  • Vue-like markup syntax
  • Write idiomatic Go code
  • Rapid prototyping
  • ~3 minute setup
  • Standard Go build tools

Start

Get started: http://www.vugu.org/doc/start

Still a work in progress, but a lot of things are already functional. Some work really well.

Abbreviated Roadmap

  • Single-file components (looks similar to .vue); .vugu -> .go code generation.
  • Includes CSS in components.
  • Basic flow control with vg-if, vg-for and output with vg-html.
  • Dynamic attributes with <tag :prop='expr'>.
  • Nested components with dynamic properties <my-custom-component :prop='expr'>.
  • Efficiently syncs to browser DOM.
  • Static HTML output (great for tests).
  • DOM Events, click, etc.
  • Basic data hashing to avoid unnecessary computation where possible.
  • Basic dev and prod server tooling, easy to get started
  • URL Router
  • Server-side rendering (HTML generation works, needs URL Router to make it usable)
  • Performance optimizations
  • Go-only component events
  • And much more...

Notes

It's built more like a library than a framework. While Vugu does do code generation for your .vugu component files, (and will even output a default main_wasm.go for a new project and build your program automatically upon page refresh), fundamentally you are still in control. Overall program flow, application wiring and initialization, the render loop that keeps the page in sync with your components - you have control over all of that. Frameworks call your code. Vugu is a library, your code calls it (even if Vugu generates a bit of that for you in the beginning to make things easier). One of the primary goals for Vugu, when it comes to developers first encountering it, was to make it very fast and easy to get started, but without imposing unnecessary limitations on how a project is structured. Go build tooling (and now the module system) is awesome. The idea is to leverage that to the furthest extent possible, rather than reprogramming the wheel.

So you won't find a vugu command line tool that runs a development server, instead you'll find in the docs an appropriate snippet of code you can paste in a file and go run yourself. For the code generation while there is an http.Handler that can do this upon page refresh, you also can (and should!) run vugugen via go generate. There are many small decisions in Vugu which follow this philosophy: wherever reasonably possible, just use the existing mechanism that already exists. And keep doing that until there's proof that something else is really needed. So far it's been working well. And it allows Vugu to focus on the specific things it brings to the table.

You can’t perform that action at this time.