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

webc layouts (and any nested components) not live updating via `eleventy --serve` #68

Closed d3v1an7 closed 1 year ago

d3v1an7 commented 1 year ago

/_includes/home.webc

<html>
  <body>
    <site-header></site-header>
    <template webc:nokeep @html="content"></template>
  </body>
</html>

/_components/site-header.webc

Header copy

/index.webc

---
layout: home.webc
---
Body copy

✅ Making changes to index.webc will immediately show change in browser ❌ Making changes to /_includes/home.webc will NOT show change in browser, and seeing the change requires server restart ❌ Making changes to /_components/site-header.webc will NOT show change in browser, and seeing the change requires server restart

It seems to possibly be an issue just with layout, because if I move the <site-header></site-header> directly into /index.webc, changes to the component will immediately show in browser again.

Using @11ty/eleventy-plugin-webc 0.10.0

BulletProofPoet commented 1 year ago

I'm having a similar issue, but worse: I can't get my page templates to update when directly embedded webc components change, either!

Whenever I change a webc component, I have to restart the server in order to see the change in the browser, regardless of whether the webc component is embedded in a page template, a layout, or another webc component. I'm trying to implement the whole site using only webc and markdown, so there are no other templating languages involved.

I'm loading my components with the following configuration in my eleventy.config.js file:

  eleventyConfig.addPlugin(pluginWebC, {
    components: 'source/_includes/components/**/*.webc'
  });

Using eleventy-plugin-webc v0.10.1.

Thanks!

janmonschke commented 1 year ago

Yep, this issue seems to have been related to webc components in layout files! A bugfix for this will be shipped with 2.0.2. Check out this related issue in the eleventy repo: https://github.com/11ty/eleventy/issues/2903

zachleat commented 1 year ago

Duplicate of https://github.com/11ty/eleventy/issues/2903

thanks!