copy assets on run if needed

This commit is contained in:
maddalax 2024-10-24 08:51:06 -05:00
parent 7af750b9e7
commit df490ae04b
3 changed files with 7 additions and 11 deletions

View file

@ -106,8 +106,7 @@ func main() {
} else if taskName == "ast" {
_ = astgen.GenAst(process.ExitOnError)
} else if taskName == "run" {
_ = astgen.GenAst(process.ExitOnError)
_ = css.GenerateCss(process.ExitOnError)
run.MakeBuildable()
_ = run.Server(process.ExitOnError)
} else if taskName == "template" {
name := ""

View file

@ -9,10 +9,14 @@ import (
"os"
)
func Build() {
func MakeBuildable() {
copyassets.CopyAssets()
astgen.GenAst(process.ExitOnError)
css.GenerateCss(process.ExitOnError)
}
func Build() {
MakeBuildable()
process.RunOrExit(process.NewRawCommand("", "mkdir -p ./dist"))

View file

@ -1,19 +1,12 @@
package run
import (
"github.com/maddalax/htmgo/cli/htmgo/tasks/astgen"
"github.com/maddalax/htmgo/cli/htmgo/tasks/copyassets"
"github.com/maddalax/htmgo/cli/htmgo/tasks/css"
"github.com/maddalax/htmgo/cli/htmgo/tasks/process"
)
func Setup() {
process.RunOrExit(process.NewRawCommand("", "go mod download"))
process.RunOrExit(process.NewRawCommand("", "go mod tidy"))
copyassets.CopyAssets()
astgen.GenAst(process.ExitOnError)
css.GenerateCss(process.ExitOnError)
MakeBuildable()
EntGenerate()
}