-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
WebC introduction #40
Conversation
modified: eleventy.config.js uncommenting L35 of eleventy.config.js `eleventy-img/*.webc` breaks build ```diff + eleventyConfig.addPlugin(pluginWebc, { + components: [ + "./_components/**/*.webc", + // "npm:@11ty/eleventy-img/*.webc", + ], + }); ``` > [11ty] Original error stack trace: Error: Check the webc:type="js" element in ./content/archive/fourthpost/fourthpost.md. > [11ty] Original error message: Cannot read properties of undefined (reading 'directories') Seems like it is getting hung up here: https://github.com/11ty/eleventy-img/blob/main/eleventy-image.webc#L72-L81 modified: content/archive/fourthpost/fourthpost.md ```diff -{% image "./possum.png", "A possum parent and two possum kids hanging from the iconic red balloon" %} +<img webc:is="eleventy-image" width="288,350" sizes="100vw" src="/img/possum.png" formats="avif,webp,png" alt="A possum parent and two possum kids hanging from the iconic red balloon"> ``` modified: package.json added webc plugin new file: _components/html/h2.webc new file: _components/html/h3.webc new file: _components/html/h4.webc new file: _components/html/heading.css renamed: content/archive/fourthpost/possum.png -> public/img/possum.png
✅ Deploy Preview for eleventeen ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
With the But when I uncomment it in the config so it includes eleventy-image.webc, build breaks with directories error. Also seems like there is no good way to override html elements like Ideally I would get the result in Tugboat/Donut with the heading anchor links, if I cleaned up the unnecessary slugify calls from Tugboat and passed in the already slugified Wide view, I am struggling with whether to ditch Nunjucks entirely now and switch over to .webc for all the .njk templates in eleventeen, or to hold off on integrating WebC further for now and to appreciate the battle-tested terseness of the Nunjucks syntax. Understanding WebC Features and Concepts was helpful as I tried to debug the error cascade, as was 11ty/eleventy-plugin-webc#22 This seemed like a good time to take stock. |
I have done an experimental conversion of the post.njk template to WebC, and although I got the posts mostly rendering, there is a cascading set of issues that arise from beginning to switch from Nunjucks to WebC. All of the archive indices hero image thumbnails broke right away, and finding a file path format/directory for the images that worked with both Nunjucks and WebC proved elusive. If any gradual conversion from .njk to .webc will be full of pain and friction, traveling further down the road of mixing Nunjucks and WebC seems unwise. Continuing to weigh doing a clean room “from scratch” implementation of eleventeen based on Tugboat/Donut, having to recreate everything already here. Sparse documentation and few examples to work off make that unappealing though. |
Question asked in Discord: If I have markdown processed into markup with slugified IDs from the new <h2 id="foo-bar">Foo Bar</h2>
<h2 id="baz-qux">Baz Qux</h2> …then in I see UPDATE: Looks like they would be in global UPDATE 2: Child components must use
– WebC v0.11.0: Child Components accessing Global Data UPDATE 3: see also… |
_components/html/h2.webc: `console.log(slots.text.default);` See 11ty/webc#151 for more on collisions
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
Just pushed 02c3b31, WIP code to document and reproduce what I think is collision happening similar to cases in 11ty/webc#151
Tried various combinations of markdownTemplateEngine: "njk",
htmlTemplateEngine: "webc", Post images broken in all the indexes now and still no heading anchors,
|
Alright building again and the collision/template garble problem is visible on the page above each heading and in the build log. |
Time to move on from Nunjucks?
Written by Bryce Wray on 2023-03-18. Notably, a month later on 2023-04-19 Nunjucks released v3.2.4 to fix CVE-2023-2142 (bugzilla #1825980). Critical security patches were still happening then, at least. |
At least until [#40](#40) finds resolution, building on the work in [#39](#39), adding [daviddarnes/heading-anchors](https://github.com/daviddarnes/heading-anchors) per rec in [11ty/eleventy #3363](11ty/eleventy#3363) Used `position="beforeend"` and styled with a slight adjustment to [demo-styling], adding `vertical-align: bottom;` to `a[href^="#"]` and constraining styles to `heading-anchors` element. demo-styling: https://github.com/daviddarnes/heading-anchors/blob/main/demo-styling.html#L11-L25
* add @daviddarnes/heading-anchors At least until [#40](#40) finds resolution, building on the work in [#39](#39), adding [daviddarnes/heading-anchors](https://github.com/daviddarnes/heading-anchors) per rec in [11ty/eleventy #3363](11ty/eleventy#3363) Used `position="beforeend"` and styled with a slight adjustment to [demo-styling], adding `vertical-align: bottom;` to `a[href^="#"]` and constraining styles to `heading-anchors` element. [demo-styling]: https://github.com/daviddarnes/heading-anchors/blob/main/demo-styling.html#L11-L25 * move heading-anchors code to base.njk instead of post.njk - add hover + focus styles for anchor links - delete deprecated css - 9.2.21-alpha.17
* add @daviddarnes/heading-anchors At least until #40 finds resolution, building on the work in #39 adding https://github.com/daviddarnes/heading-anchors per rec in 11ty/eleventy#3363 Used `position="beforeend"` and styled with a slight adjustment to https://github.com/daviddarnes/heading-anchors/blob/main/demo-styling.html#L11-L25 adding `vertical-align: bottom;` to `a[href^="#"]` and constraining styles to `heading-anchors` element. * move heading-anchors code to base.njk instead of post.njk - add hover + focus styles for anchor links - delete deprecated css
Moving on with #41 for now and EDIT: closing this…
|
From unpublished Donut testing, we need markdownTemplateEngine: "webc",
htmlTemplateEngine: "webc", there. This repo relies on Nunjucks in too many places to do that now but food for thought. WebC holds tons of promise, but basic issues like how do I Considering switching from Nunjucks to Liquid, mainly for Bookshop compatibility. So at this point it is Liquid vs WebC, with Liquid in the lead. Main factors so far:
Unless final evaluation truly surprises me, Nunjucks is on it’s way out either way. |
modified: eleventy.config.js
uncommenting L35 of eleventy.config.js (
eleventy-img/*.webc
) breaks buildSeems like it is getting hung up here:
https://github.com/11ty/eleventy-img/blob/main/eleventy-image.webc#L72-L81
modified: content/archive/fourthpost/fourthpost.md
modified: package.json
added webc plugin
new file: _components/html/h2.webc
new file: _components/html/h3.webc
new file: _components/html/h4.webc
new file: _components/html/heading.css
renamed: content/archive/fourthpost/possum.png -> public/img/possum.png