Skip to content
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

Skip bundling within excluded files #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

darekkay
Copy link

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.

Fixes: #59

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).

Fixes: 11ty#59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

renderFile of a WebC include within a draft fails on build
1 participant