-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Easy way to serialize all host component attributes/props in JavaScript #104
Comments
Adding something like a "props" object that contains them all would be a big help here too, as it would at least let us do it manually. I tried using "this" but of course that has loads of other stuff on it so didn't work. |
A new |
Related test has a usage example, notably this will not render private props: https://github.com/11ty/webc/blob/06768af3fb20b1d416276f2f07ac3865a4f3a80c/test/issue-104-test.js <script webc:type="js" webc:root="override">
`<img ${webc.renderAttributes(webc.attributes)}>`
</script> Will ship with WebC v0.9.0 |
Perfect! Thank you |
Docs for this will live at https://www.11ty.dev/docs/languages/webc/#extra-data-for-javascript-render-functions |
Notably you can use
webc:root
to re-use and merge host component attributes in a component definition in markup.https://www.11ty.dev/docs/languages/webc/#attributes-and-webcroot
This would be the script alternative to this (for
webc:type="js"
orwebc:type="render"
)cc @ascorbic
The text was updated successfully, but these errors were encountered: