-
-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add templ elements, and templ block elements #51
Conversation
@a-h I'm happy that this works as expected now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is looking good. I've suggested a couple of minor bits and pieces. Nothing major.
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) { | ||
ctx, _ = templ.RenderedCSSClassesFromContext(ctx) | ||
ctx, _ = templ.RenderedScriptsFromContext(ctx) | ||
var_1 := ctx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to create a variable instead of using ctx
directly? I can't see why childrenVar is used, would be good to remove it if possible, just because it's state inside the generator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to prevent children being used in components that are nested, I separated it into its own context so that only the { children... } further down can access that context.
If that makes sense.
Otherwise if another templElement was rendered in this component it would get the children passed in, which is bad.
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Co-authored-by: Adrian Hesketh <a-h@users.noreply.github.com>
Was thinking of updating the "Write" function of the calltemplate expression to write out the new syntax. So templ fmt would migrate |
No description provided.