Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/hadihammurabi/gom
- Owner: hadihammurabi
- Created: 2021-12-13T14:59:52.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T14:41:21.000Z (about 3 years ago)
- Last Synced: 2024-11-07T08:38:58.869Z (about 2 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gom
DOM building using Go# Usage
```go
package mainimport "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 PageWelcome to our Home Page!
```or use DOM utilities
```go
package mainimport "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 mainimport "github.com/hadihammurabi/gom"
func main() {
dom := gom.H("script").C(
gom.H(
`
alert("welcome message!!!");
`,
gom.IsFinite),
)println(dom.Build())
}
```