A multi-platform UI framework that uses Go, HTML and CSS.
# Install:
go get -u -v github.com/murlokswarm/app/...
# Update:
goapp update -v
Platform | Status |
---|---|
MacOS | ✔ |
Web | ✔ |
Windows | 🔨 |
Linux | ✖ |
# Go to your repository:
cd YOUR_REPO
# Init the repo:
goapp mac init
// YOUR_REPO/main.go
// Hello compo.
type Hello struct {
Name string
}
func (h *Hello) Render() string {
return `
<div class="Hello">
<h1>
Hello
{{if .Name}}
{{.Name}}
{{else}}
world
{{end}}!
</h1>
<input value="{{.Name}}" placeholder="Write a name..." onchange="Name" autofocus>
</div>
`
}
func main() {
app.Import(&Hello{})
// Use mac driver with Hello compo.
app.Run(&mac.Driver{
URL: "/hello",
})
}
# Build and run with debug mode:
goapp mac run -d
View full example.
An elem represents an UI element to be displayed. Some can be customized with HTML content:
Others are simple:
A compo represents an independent and reusable piece of UI. It exposes an HTML representation of the UI that can be customized by the template syntax defined in the Go standard library. Compos are loaded into elems that support HTML customization.
A driver represents the app backend. It exposes Go operations to create/modify the UI and calls their platform specific implementations.
Goapp is a CLI tool to build and run apps built with the app package.
Depending on the platform, apps must be packaged in order to be deployed and distributed. Packaged applications are usually not managed by a terminal, which can be an issue when we want to monitor the logs or stop their execution with system signals.
Goapp can package apps and allows to run them while keeping logs and managing their lyfecycle within the terminal.
Examples:
goapp -h # Help.
goapp mac -h # Help for MasOS commands.
goapp mac run -h # Help for MasOS run command.
goapp mac run # Run MacOS .app.
goapp mac run -d # Run MacOS .app with debug.
goapp web run # Run a web server.
goapp web run -b # Run a web server and launch the main page in the default browser.
If this project helps you build awesome UI, you can help me grow my cryptos :)
Crypto | Address |
---|---|
Ethereum (ETH) | 0x789D63B8869783a15bbFb43331a192DdeC4bDE53 |
Bitcoin (BTC) | 3PRMM9fj7yq9gHxgk2svewWF9BkzzGPa1b |