diff --git a/cli/tasks/process/process.go b/cli/tasks/process/process.go index 8a0dbdd..460cbd0 100644 --- a/cli/tasks/process/process.go +++ b/cli/tasks/process/process.go @@ -96,6 +96,7 @@ func KillAll() { } commands = make([]*exec.Cmd, 0) + fmt.Printf("all processes killed\n") } func PidExists(pid int32) (bool, error) { diff --git a/cli/tasks/reloader/reloader.go b/cli/tasks/reloader/reloader.go index 515978c..ea14e14 100644 --- a/cli/tasks/reloader/reloader.go +++ b/cli/tasks/reloader/reloader.go @@ -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) } } diff --git a/starter-template/pages/index.go b/starter-template/pages/index.go index bde1c17..f0ddde6 100644 --- a/starter-template/pages/index.go +++ b/starter-template/pages/index.go @@ -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"),