-
Notifications
You must be signed in to change notification settings - Fork 62
/
main.go
66 lines (57 loc) · 1.16 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"log"
"strings"
astro "github.com/snowpackjs/go-astro/internal"
)
func main() {
s := `---
// Component Imports
import Counter from '../components/Counter.jsx'
// Full Astro Component Syntax:
// https://docs.astro.build/core-concepts/astro-components/
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, viewport-fit=cover"
/>
<style>
:global(:root) {
font-family: system-ui;
padding: 2em 0;
}
:global(.counter) {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
place-items: center;
font-size: 2em;
margin-top: 2em;
}
:global(.children) {
display: grid;
place-items: center;
margin-bottom: 2em;
}
</style>
</head>
<body>
<main>
<Counter client:visible>
<h1>Hello React!</h1>
</Counter>
</main>
</body>
</html>
`
doc, err := astro.Parse(strings.NewReader(s))
if err != nil {
log.Fatal(err)
}
w := new(strings.Builder)
astro.Render(w, doc)
fmt.Println(w.String())
}