-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Allow script components to be rendered inline #285
Conversation
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.
Brilliant. It's a better idea than what I had on how to achieve the same goal.
Well thought out and done. Just a few minor things on docs etc., and it's good to go. Thanks for your work on this.
Looks like switching to slices might have broken something... Will look on Sunday 👀 |
Yes, that was a bad idea of mine then, sorry! :) thanks for looking into it! |
Alright, should be fixed! |
Thanks! |
I literally just ran into this use case today while learning templ, what a coincidence and thanks for this! |
Allows templ to render
script
components, which is useful for inline Javscript. As of now,script
components can really only be used within HTML attributes. This extends the!
usage to now enable embedding Javascript outside HTML attributes.This fixes #231
I've also added a test case to show how it would be used (and what would be rendered). I've ensured that things should be backwards compatible, the only things that new generator runs would introduce is the new
CallInline
struct member (which is only called if you use this new functionality).