11ty / eleventy-plugin-webc

Adds support for WebC *.webc files to Eleventy
https://www.11ty.dev/docs/languages/webc/
119 stars 10 forks source link

Not a full `this` when calling a component from a Liquid template #39

Open pauleveritt opened 1 year ago

pauleveritt commented 1 year ago

Let's say I have:

{% renderTemplate "webc" %}
<my-custom-component></my-custom-component>
{% endrenderTemplate %}

Then my-component.webc:

---
title: My Component
---
<span @text="title">Placeholder</span>

If I render my-component.webc directly via new WebC() passing in page data, it works fine. But via Liquid, the this is missing page data, helpers, everything. (Confirmed with a debugger statement.)

If I replace my Liquid template with a WebC template, I get the full this.

zachleat commented 1 year ago

Can you provide more context here? Is my-component.webc a Eleventy template or a child WebC component? Where does renderTemplate live?

I’m guessing this was fixed with the data consistency review for https://github.com/11ty/webc/issues/88#issuecomment-1431779586 shipping in WebC v0.9.0