-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Scripts and styles are not aggregated in the root WebC layout template #11
Comments
Confirming that I'm encountering similar issues. When I follow along with the Crash Course in Eleventy’s new WebC Plugin YouTube video and insert <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body><my-component>HELLO I AM A COMPONENT
</my-component></body>
</html> |
I think I might have the same issue using a different approach: I tried creating a
Then, instead of setting the layout using front matter, I used the layout as a component in
|
The nested layouts workaround doesn't appear to work any more. @zachleat is it possible that the 11ty/eleventy#2654 fix stopped this working? Since nested WebC layouts are correctly treated as layouts now. Given that layouts ideally need to support bundling, is there a better solution than disabling it for only the root layout (assuming 11ty knows which one that is). This would be awkward but at least documentable as a way to bundle components that are used in layouts. |
Shipping this with Eleventy WebC v0.8.0 (likely Monday). More details in #33 |
Eleventy WebC v0.8.0 is out! https://github.com/11ty/eleventy-plugin-webc/releases/tag/v0.8.0 |
Zach fixed 11ty/eleventy-plugin-webc#11 so the root.webc layout template is no longer needed to aggregate styles and scripts.
If you’re using WebC for layout templates, you can’t put WebC components in the layout that calls
this.getCSS
orthis.getJS
and have its styles and scripts be aggregated.Let me know if you’d like a repo with a reproduction of the issue.
Example
site-footer.webc
base.webc
Output
Note the empty
<style>
tag.Workaround
You can work around this issue by adding a template in the layout chain so that you aren't including styled components in your root layout template.
root.webc
base.webc
The text was updated successfully, but these errors were encountered: