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

Add a default value for components directory option #14

Closed
zachleat opened this issue Oct 19, 2022 · 3 comments
Closed

Add a default value for components directory option #14

zachleat opened this issue Oct 19, 2022 · 3 comments
Labels
breaking-change enhancement New feature or request

Comments

@zachleat
Copy link
Member

zachleat commented Oct 19, 2022

I think components: "_components/**/*.webc" is probably appropriate.

Will need to handle ignores and watch targets correctly!

Suggested by @cfjedimaster here: https://www.raymondcamden.com/2022/10/16/first-experience-building-with-eleventys-webc-plugin

@zachleat zachleat added enhancement New feature or request breaking-change labels Oct 19, 2022
@zachleat
Copy link
Member Author

zachleat commented Oct 19, 2022

I would also note that the reason we didn’t just use components: "_includes/**/*.webc is to avoid conflicts between WebC Components and WebC for Eleventy Layouts. We don’t want to waste resources compiling a WebC Layout file as a component (and vice versa).

@zachleat
Copy link
Member Author

zachleat commented Nov 16, 2022

The other thing I would note here is that both _includes and _layouts are relative to the input directory, but components is not 😔

https://www.11ty.dev/docs/config/#directory-for-includes
https://www.11ty.dev/docs/config/#directory-for-layouts-(optional)

https://www.11ty.dev/docs/languages/webc/#global-no-import-components

One future-compatible idea here is to add an alias here to make the path relative to the input directory (we already have one for the root directory for webc.components in front matter).

(Aliasing docs: https://www.11ty.dev/docs/languages/webc/#webcimport https://www.11ty.dev/docs/languages/webc/#declaring-components-in-front-matter)

@zachleat
Copy link
Member Author

This will ship with _components/**/*.webc in Eleventy WebC v0.7.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant