-
-
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
<script webc:setup> Expose JS defined in <script> tags to component's template #109
Comments
Related #87 |
Has access to the standard stuff from the WebC data cascade: global data (Eleventy’s data cascade), helper functions, etc. A few test cases here: https://github.com/11ty/webc/blob/efe23f6c12ac8505c52f9cfedc0bce6f4d0ad750/test/stubs/setup-script/test.js
|
cc @mayank99 who might be interested in this |
This is amazing! Couple questions:
|
This may feel like whiplash but personally I don’t think we need That said, On data scoping
On rendering:
Using <script webc:setup>
let myHtml = "<my-webc-component>";
</script>
<template @html="myHtml" webc:nokeep></template> On data access:
|
This is fantastic! Thank you so much for taking the time to implement this Zach ❤️ I can't wait to have a play! |
This is awesome! This is exactly what I needed for a project today. I'm excited to play with this. Thanks Zach! |
It would be great if variables, functions, etc, that are defined in a
.webc
component's<script>
tag could be referenced within that component's template. Similar to Vue's<script setup>
Something like this:It would also be great if we could reference global Eleventy data here, something like:
It could also be really interesting if the functions, variables, etc, defined in the
<script>
tag could be used both at build time, but also be carried over to the client for use withis-land
and other interactive elements. I feel like this could be really powerful!The text was updated successfully, but these errors were encountered: