Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hadihammurabi/gom

DOM building using Go
https://github.com/hadihammurabi/gom

Last synced: 7 days ago
JSON representation

DOM building using Go

Awesome Lists containing this project

README

        

# gom
DOM building using Go

# Usage
```go
package main

import "github.com/hadihammurabi/gom"

func main() {
dom := gom.H("html").C(
gom.H("head").C(
gom.H("title").C(
gom.H("Home Page", gom.IsFinite),
),
),
gom.H("body").C(
gom.H("h1").C(
gom.H("Welcome to our Home Page!", gom.IsFinite),
),
),
)

println(dom.Build())
}
```

it will shows
```html
Home Page

Welcome to our Home Page!


```

or use DOM utilities
```go
package main

import "github.com/hadihammurabi/gom"

func main() {
dom := gom.HTML.C(
gom.Head.C(
gom.Title.C(
gom.Text("Home Page"),
),
),
gom.Body.C(
gom.H1.C(
gom.Text("Welcome to Home Page!"),
),
),
)

println(dom.Build())
}
```

You want JS? It will do for you!
```go
package main

import "github.com/hadihammurabi/gom"

func main() {
dom := gom.H("script").C(
gom.H(
`
alert("welcome message!!!");
`,
gom.IsFinite),
)

println(dom.Build())
}
```