You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context, I'm currently using Air for hot reload, and thus on file changes I make it run templ generate.
Say you create a .templ file (say, "foo.templ"), and eventually rename it (say "bar.templ"). foo_templ.go is still there.
Could lead to bugs or wasted time (specially for me since I was hiding all *_templ.go files in my ide)
Thus propose: templ generate --remove-old or a new templ remove-old to delete such old generated files would be nice. I suppose not by default to keep it backwards compatible.
If it sounds like a good idea lmk I could try make it and submit a PR.
[currently doing a weird unnessary regex rm hack deleting all _templ.go file in my templates before tmpl generate ls -d -1 "$PWD/internal/templates/"*.* | grep -P "^.*_templ\.go$" | xargs -d "\n" rm]
Love the project!
The text was updated successfully, but these errors were encountered:
Glad you like templ! I see your point, it's confusing to rename a file, and then have the old Go code stuck around.
I think it would be best to make removing _templ.go files that don't have a corresponding .templ file the default, and add a command line flag to not remove "orphaned" generated files. So, the CLI flag would be templ generate --keep-orphaned-files.
Probably best to wait until #299 is merged before starting, because it changes the generate command a little.
Context, I'm currently using Air for hot reload, and thus on file changes I make it run
templ generate
.Say you create a .templ file (say, "foo.templ"), and eventually rename it (say "bar.templ").
foo_templ.go
is still there.Could lead to bugs or wasted time (specially for me since I was hiding all *_templ.go files in my ide)
Thus propose:
templ generate --remove-old
or a newtempl remove-old
to delete such old generated files would be nice. I suppose not by default to keep it backwards compatible.If it sounds like a good idea lmk I could try make it and submit a PR.
[currently doing a weird unnessary regex rm hack deleting all _templ.go file in my templates before tmpl generate
ls -d -1 "$PWD/internal/templates/"*.* | grep -P "^.*_templ\.go$" | xargs -d "\n" rm
]Love the project!
The text was updated successfully, but these errors were encountered: