Closed Z3NTL3 closed 3 months ago
I've changed it to:
templ TREE(props Page, page func() templ.Component) {
<!DOCTYPE html>
<html lang="en">
<head>
@META(props)
@IMPORTS()
</head>
<body>
@page()
</body>
</html>
}
or
templ TREE(props Page, page templ.Component) {
<!DOCTYPE html>
<html lang="en">
<head>
@META(props)
@IMPORTS()
</head>
<body>
@page
</body>
</html>
}
Which after templ generate
, the generated file for tree, contained the package import of my embed, however it was not used so had to manually remove that. Doing that resolved this and works.
Hi,
My understanding of what you've written is that you initially thought that templ couldn't accept parameters, so your initial proposal was to make that possible.
However, in your second comment on this issue, you worked out that it could (as per the docs at https://templ.guide/syntax-and-usage/template-composition/
Based on this, I don't think there's an issue to resolve, so I'll close it. Feel free to re-open if I've misunderstood your intention.
Thanks, Adrian.
I like
templ
and it's really nice. However, I think a great addition will be the oppurtunity for our template functions to accept atempl.Component
and render the embedded page from within. That's much more convenient for my use-case.Instead of:
Something like that below, is more convenience, compared to the previous snippet:
When I do template generate, i get an error from GOPLS.