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

Can't seem to get :attribute working with webc:root #194

Open
hojberg opened this issue Sep 28, 2023 · 0 comments
Open

Can't seem to get :attribute working with webc:root #194

hojberg opened this issue Sep 28, 2023 · 0 comments

Comments

@hojberg
Copy link

hojberg commented Sep 28, 2023

Here's a simple example of a component where I don't want a wrapping element:

<script webc:setup>
  function featureSize(size) {
    return `feature_${size.replace("/", "-")}`;
  }
</script>
<section webc:root :class="featureSize(size)">
  <!-- ... -->
</section>

This fails with:

[11ty] 1. Having trouble rendering webc template ./src/index.webc (via TemplateContentRenderError)
[11ty] 2. Evaluating a dynamic attribute failed: `:class="featureSize(size)"`.
[11ty] Original error message: featureSize is not a function (via Error)

I'm not sure how to best deal with this. Seems like js isn't accessible on the root element or something like that?

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

No branches or pull requests

1 participant