Skip to content
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

Add webc:is="template" to webc:type="js"(and render) docs #91

Closed

Conversation

okmanideep
Copy link

@okmanideep okmanideep commented Dec 21, 2022

Issue with the current README.md

img.webc in README, doesn't actually render the returned string in the webc:type="js" and webc:type="render" script blocks. Since it is missing webc:is="template"

- <script webc:type="js">
+ <script webc:type="js" webc:is="template">

Figured this out after looking at examples/render/components/img.webc (Thanks to @manekinekko)

Is this really required?

The syntax in the current docs which is not working, actually looks intuitive.

Just like we aren't adding an extra template for normal HTML, we shouldn't need to specify webc:is="template" for the render scripts.

Thoughts?

Figured this out after looking at
[`examples/render/components/img.webc`](https://github.com/11ty/webc/blob/main/examples/render/components/img.webc)

Should this be needed though? the syntax in the current docs which is
wrong, looks intuitive enough.

Just like we aren't adding an extra `template` for normal HTML, we
shouldn't need to specify `webc:is="template"` for the render scripts.

Thoughts?
@zachleat zachleat self-assigned this Feb 10, 2023
@zachleat zachleat closed this in 471422d Feb 16, 2023
@zachleat zachleat added this to the WebC v0.9.0 milestone Feb 16, 2023
@zachleat
Copy link
Member

HMMMMMMMM. I wrote out a big long response here but I think you’re right and I want to fix this in the library.

Starting in WebC v0.9.0 the following changes will smooth this a bit:

  1. [Breaking] webc:type="js" will have an implied webc:is="template" (unless otherwise specified) and an implied webc:nokeep (unless webc:keep specified)
  2. [Breaking] Instead of webc:root webc:keep, you must use webc:root="override" instead
  3. We’ll also ease up on circular component references when using webc:root in component definitions
  4. I also spotted a bug with attribute merging class and style when using webc:root and those attributes do not exist in host component, which also rolled up with this change.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants