chore: gitignore generated _templ.go files, track .templ sources
Generated _templ.go files are deterministic output from .templ sources, same as output.css from input.css. Remove them from version control to reduce diff noise and merge conflicts. Add build:templ and live:templ tasks to the Taskfile so generation happens as part of the build.
This commit is contained in:
19
Taskfile.yml
19
Taskfile.yml
@@ -6,12 +6,22 @@ tasks:
|
||||
cmds:
|
||||
- go run cmd/downloader/main.go
|
||||
|
||||
build:templ:
|
||||
desc: Compile .templ files to Go
|
||||
cmds:
|
||||
- go tool templ generate
|
||||
sources:
|
||||
- "**/*.templ"
|
||||
generates:
|
||||
- "**/*_templ.go"
|
||||
|
||||
build:styles:
|
||||
desc: Build TailwindCSS styles
|
||||
cmds:
|
||||
- go tool gotailwind -i assets/css/input.css -o assets/css/output.css --minify
|
||||
sources:
|
||||
- "assets/css/input.css"
|
||||
- "**/*.templ"
|
||||
- "**/*.go"
|
||||
generates:
|
||||
- "assets/css/output.css"
|
||||
@@ -21,8 +31,14 @@ tasks:
|
||||
cmds:
|
||||
- go build -o bin/c4 .
|
||||
deps:
|
||||
- build:templ
|
||||
- build:styles
|
||||
|
||||
live:templ:
|
||||
desc: Watch and recompile .templ files
|
||||
cmds:
|
||||
- go tool templ generate -watch
|
||||
|
||||
live:styles:
|
||||
desc: Watch and rebuild TailwindCSS styles
|
||||
cmds:
|
||||
@@ -36,12 +52,13 @@ tasks:
|
||||
-build.cmd "go build -tags=dev -o tmp/bin/c4 ." \
|
||||
-build.bin "tmp/bin/c4" \
|
||||
-build.exclude_dir "data,bin,tmp,deploy" \
|
||||
-build.include_ext "go" \
|
||||
-build.include_ext "go,templ" \
|
||||
-misc.clean_on_exit "true"
|
||||
|
||||
live:
|
||||
desc: Dev mode with hot-reload
|
||||
deps:
|
||||
- live:templ
|
||||
- live:styles
|
||||
- live:server
|
||||
|
||||
|
||||
Reference in New Issue
Block a user