It seems like when using templ generate --watch, and things change, some of the components are not rendered correctly after.
Assuming this code:
templ aComponent() {
<pre>
this is a pre tag from a component
</pre>
}
templ LandingPage() {
@layout() {
<main>
<h1>Hello world!</h1>
<p>templ is awesome, but it seems to have issues with template generation when using --watch</p>
<h2>You should see a component under</h2>
// Try to uncomment this after starting with --watch
// @aComponent()
<p>Hello again! We are done with the components</p>
</main>
}
}
Should produce this:
<!-- Layout -->
<main>
<h1>Hello world!</h1>
<p>templ is awesome, but it seems to have issues with template generation when using --watch</p>
<h2>You should see a component under</h2>
<p>Hello again! We are done with the components</p>
</main>
<!-- /Layout -->
However, if you uncomment @aComponent() while running --watch, you
get this:
<!-- Layout -->
<main>
<h1>Hello world!</h1>
<p>templ is awesome, but it seems to have issues with template generation when using --watch</p>
<h2>You should see a component under</h2>
</main>
<!-- /Layout -->
Describe the bug
It seems like when using
templ generate --watch
, and things change, some of the components are not rendered correctly after.Assuming this code:
Should produce this:
However, if you uncomment
@aComponent()
while running--watch
, you get this:To Reproduce
task dev
to start thetempl generate --watch
(and go server)http://localhost:8080
(orhttp://localhost:7331
for the proxyed version)@aComponent
intemplates/landing.templ
and save the fileScreenshots
This is how it is supposed to look:
After changing, this is how it looks:
Everything goes back to how it supposed to when generating like normal with
templ generate
.Logs
templ info
output