Excluded files (permalink: false) won't be rendered, hence bundling of CSS/JS resources is not required. This change not only improves the build performance, it fixes a bug where "renderFile" with WebC fails for excluded files (e.g. drafts).
Here's the high-level flow of what is happening:
eleventyWebcTemplate.js calls the css and js shortcodes with data.page.url as the last parameter. For draft posts, this value is false.
eleventy.shortcodes.js checks for urlOverride || this.page.url. As the urlOverride is false, it tries to access this.page.url. As this.page is undefined, this throws an error.
I have added a new test to verify the problem. Revert the code change that I did to see the test failing.
Excluded files (
permalink: false
) won't be rendered, hence bundling of CSS/JS resources is not required. This change not only improves the build performance, it fixes a bug where "renderFile" with WebC fails for excluded files (e.g. drafts).Here's the high-level flow of what is happening:
eleventyWebcTemplate.js
calls thecss
andjs
shortcodes withdata.page.url
as the last parameter. For draft posts, this value isfalse
.eleventy.shortcodes.js
checks forurlOverride || this.page.url
. As theurlOverride
isfalse
, it tries to accessthis.page.url
. Asthis.page
isundefined
, this throws an error.I have added a new test to verify the problem. Revert the code change that I did to see the test failing.
Fixes: #59