This commit is contained in:
maddalax 2024-09-17 12:29:33 -05:00
parent fe409c363c
commit b102bd754b
3 changed files with 12 additions and 11 deletions

View file

@ -96,6 +96,7 @@ func KillAll() {
}
commands = make([]*exec.Cmd, 0)
fmt.Printf("all processes killed\n")
}
func PidExists(pid int32) (bool, error) {

View file

@ -80,6 +80,7 @@ func OnFileChange(events []*fsnotify.Event) {
if c.HasAnySuffix("tailwind.config.js", ".css") {
tasks.Css = true
tasks.Run = true
}
if c.HasAnyPrefix("ent/schema") {
@ -95,12 +96,6 @@ func OnFileChange(events []*fsnotify.Event) {
})
}
if tasks.Css {
deps = append(deps, func() any {
return css.GenerateCss(false)
})
}
if tasks.Ent {
deps = append(deps, func() any {
run.EntGenerate()
@ -123,8 +118,13 @@ func OnFileChange(events []*fsnotify.Event) {
wg.Wait()
process.KillAll()
if tasks.Css {
go css.GenerateCss(false)
}
if tasks.Run {
process.KillAll()
_ = run.Server(false)
}
}

View file

@ -10,7 +10,7 @@ import (
func IndexPage(c echo.Context) *h.Page {
return h.NewPage(h.Html(
h.HxExtension(base.Extensions()),
h.Class("bg-slate-100 flex flex-col items-center h-full w-full"),
h.Class("bg-red-200 flex flex-col items-center h-full w-full"),
h.Head(
h.Link("/public/main.css", "stylesheet"),
h.Script("/public/htmgo.js"),
@ -21,7 +21,7 @@ func IndexPage(c echo.Context) *h.Page {
h.Class("flex flex-col items-center justify-center gap-6 p-12 text-center"),
h.H1(
h.Class("text-4xl sm:text-5xl font-bold max-w-3xl"),
h.Text("test"),
h.Text("changed this"),
),
h.P(
h.Class("text-lg sm:text-xl max-w-1xl"),
@ -35,8 +35,8 @@ func IndexPage(c echo.Context) *h.Page {
}
func Button() h.Renderable {
return h.Button(h.Class("btn bg-red-500 p-4 rounded text-white"),
h.Text("this is my nice this works"),
return h.Button(h.Class("btn bg-green-500 p-4 rounded text-white"),
h.Text("my button"),
h.AfterRequest(
h.SetDisabled(true),
h.RemoveClass("bg-red-600"),