Skip to content

influx6/gu

 
 

Repository files navigation

I would encourage you to use Vecty instead.

Gu [DEPRECATED]

Go Report Card Build Status

A component rendering library for Go. It efficiently renders standard HTML both on the frontend and backend.

Install

First go get gopherjs, as we can not bundle it due to certain restrictions in the way gopherjs works.

go get github.com/gopherjs/gopherjs

Once done, then go get this package and you are ready to go.

go get github.com/gu-io/gu/...

Do check out the Concepts section to get to know how Gu works.

Example

Greeter Example Components Example

CLI

Gu provides a cli tooling which is installed when go get is done for this package, the tooling provides easier means of generating a project and components using the gu project, among other features.

It is provided to both improve the workflow of the user, as well as to provide quick setup of your project. Provided below are examples of workflows which are generally done when developing with Gu.

  • Creating a Gu project
> ➜ gu app box
- Creating package directory: "box"
- Creating package directory: "box/public"
- Creating package directory: "box/public/less"
- Add file to package directory: "box/public/less/box.less"
- Add file to package directory: "box/settings.toml"
- Add file to package directory: "box/settings_bundle.go"
- Add file to package directory: "box/public_bundle.go"
- Add file to package directory: "box/public/box_bundle.go"
- Add file to package directory: "box/box.go"
➜ cd box
➜ gu driver js
- Creating package directory: "driver/js"
- Add file to package directory: "driver/js/main.go"
- Add file to package directory: "public/index.html"

  • Add a component with initial boilerplate

➜ gu component sugarbar
- Creating package directory: "/home/ewe/devlabs/src/github.com/gu-io/box/sugarbar"
- Add file to package directory: "sugarbar/sugarbar.go"
- Add file to package directory: "sugarbar/sugarbar_bundle.go"
- Add file to package directory: "sugarbar/generate.go"

The generated package can be found here https://github.com/gu-io/box.

Goals

  • Dead Simple API.
  • Embeddable Resources.
  • Simplicity and Flexibility as core philosophies.
  • Able to render on both front and back end.
  • Quickly craft your UI without touching HTML.
  • Share code between backend and frontend.
  • Efficient and extendable asset bundling for all possible file types.

Advantages

  • Complex component libraries can be built up and shared as Golang packages.
  • Components are hierarchical allowing further reuse.
  • Event handling is simple and strongly typed.
  • Compile time safety
  • Bundles all assets (with less files natively converted)
  • Minify all css outputs.

Examples

The github repo Components contains gu style components that showcases how to build components with gu.

Concepts

Gu is fundamentally a library built to provide rendering capabilities with simple principles in building components that make up your application. There exists certain concepts which should be grasped due to the architecture and these do make it easier to reason and thinking when using the library. To fully grasp these concept, there is set below a series of short explanations about the different core pieces that make up the libray and I hope these will help in the use of this libray and it's examples.

How to Contribute

Please read the contribution guidelines Contribution Guidelines

Limitations

Gu by it's very design and architecture is "Simple". It lacks the bells and whistles of similar frameworks and libraries. It's geared towards solving your rendering needs and due to this, certain limitations exist with it.

  • Gu provides no react like flux structure.

  • Gu only focuses on providing you sets of structures able to work on the client and server for HTML/HTML5 rendering markup rendering with diffing support.

  • Gu component are simply Go types that implements Gu's set of interfaces and nothing else.

Once these limitations are not a problem, I believe using the library should help in achieving the end product and design you wish to build.

Last Note

Please feel free to make issues on suggestions, questions, changes, bugs or improvements for the library. They all will be gladly received with much fan-fare.

God bless.

About

A web ui library for Go. [DEPRECATED]

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 85.6%
  • CSS 10.9%
  • JavaScript 3.1%
  • Other 0.4%