Closed solution-loisir closed 1 year ago
webc.renderAttributes
does this for you, but it does give a string back—and it looks like generateHTML does not accept a string. Good point!
I guess that's a bit of an edge case. Thank you for considering! 😊
webc.filterPublicAttributes(webc.attributes)
will ship with WebC 0.10.1!
Thank you!
I'm building an
image-process
component which use the eleventy-img plugin and it would be useful to have access to an object of public attributes only to feed to thegenerateHTML
method. When usingwebc.attributes
directly I get all the attributes includingwebc:*
,@attributes
,:@my-private-attribute
, etc. I came with my own (maybe naive) workaround which is filteringwebc.attributes
. It works, but it is very brittle.Something like
webc.attributes.public
orgetPublic(webc.attributes)
would do. Here's the full component for context.So far, I'm having a lot of fun writing WebC! Thank you so much!