feat: Makefile for local development
would be even more useful when i'll get tailwind and stuff
This commit is contained in:
parent
81235e3ce6
commit
de2fd2bdc0
|
@ -0,0 +1,20 @@
|
|||
# List of all .templ files
|
||||
TEMPL_FILES := $(wildcard *.templ)
|
||||
|
||||
# Name of the generated file(s) from templ
|
||||
GENERATED_FILES := $(TEMPL_FILES:.templ=_templ.go)
|
||||
|
||||
# Generate Go files from .templ files only if they have changed
|
||||
$(GENERATED_FILES): $(TEMPL_FILES)
|
||||
templ generate
|
||||
|
||||
# Run task depends on the generated files
|
||||
run: $(GENERATED_FILES)
|
||||
go run .
|
||||
|
||||
# this uses wgo to re-execute 'make run'
|
||||
# which will toggle templ generate, when needed
|
||||
# and then do `go run .` to rebuild all else
|
||||
.PHONY: run/live
|
||||
run/live:
|
||||
wgo -verbose -file=.go -file=.templ make run
|
|
@ -1,5 +1,10 @@
|
|||
package main
|
||||
|
||||
var myVar string = "some string, changed. and more"
|
||||
var anotherVar string = "hoho, cool"
|
||||
|
||||
templ hello(name string) {
|
||||
<div>Hello, {name}</div>
|
||||
}
|
||||
<div>Hello, {name}. referencing var: {myVar}</div>
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue