~repos /gromer
git clone https://pyrossh.dev/repos/gromer.git
gromer is a framework and cli to build multipage web apps in golang using htmx and alpinejs.
5bb1eb51
—
Peter John 3 years ago
fix cmd
- cmd/gromer/main.go +9 -8
cmd/gromer/main.go
CHANGED
|
@@ -14,6 +14,7 @@ import (
|
|
|
14
14
|
|
|
15
15
|
"github.com/pyros2097/gromer"
|
|
16
16
|
"github.com/pyros2097/gromer/handlebars"
|
|
17
|
+
. "github.com/pyros2097/gromer/handlebars"
|
|
17
18
|
"golang.org/x/mod/modfile"
|
|
18
19
|
)
|
|
19
20
|
|
|
@@ -156,13 +157,7 @@ func main() {
|
|
|
156
157
|
if err != nil {
|
|
157
158
|
log.Fatal(err)
|
|
158
159
|
}
|
|
159
|
-
ctx := handlebars.NewContext()
|
|
160
|
-
ctx.Set("moduleName", moduleName)
|
|
161
|
-
ctx.Set("routes", gromer.RouteDefs)
|
|
162
|
-
ctx.Set("routeImports", routeImports)
|
|
163
|
-
ctx.Set("componentNames", componentNames)
|
|
164
|
-
ctx.Set("tick", "`")
|
|
165
|
-
|
|
160
|
+
t := Html(`// Code generated by gromer. DO NOT EDIT.
|
|
166
161
|
package main
|
|
167
162
|
|
|
168
163
|
import (
|
|
@@ -200,7 +195,13 @@ func main() {
|
|
|
200
195
|
log.Fatal().Stack().Err(err).Msg("failed to listen")
|
|
201
196
|
}
|
|
202
197
|
}
|
|
203
|
-
`
|
|
198
|
+
`)
|
|
199
|
+
t.Context.Set("moduleName", moduleName)
|
|
200
|
+
t.Context.Set("routes", gromer.RouteDefs)
|
|
201
|
+
t.Context.Set("routeImports", routeImports)
|
|
202
|
+
t.Context.Set("componentNames", componentNames)
|
|
203
|
+
t.Context.Set("tick", "`")
|
|
204
|
+
s, _, err := t.Render()
|
|
204
205
|
if err != nil {
|
|
205
206
|
panic(err)
|
|
206
207
|
}
|