-
-
Notifications
You must be signed in to change notification settings - Fork 485
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
useLayouts
option for Custom template syntax allows opt-out of Eleventy Layouts for a template type
#2830
Comments
Unfortunately eleventy's genericity makes it sort of blind to basic structural patterns in its most dominant use case (websites). On the positive side, this blindness allows novel extensions of its processing pipeline -- which is why SASS is recommended on the website to be added in the same manner as html templates. But I think it's being misapplied in these cases, because the tools were obviously designed for html templating (with things like page resources and a layout field). This is clear in the statement on the website "Note also that the data is not used in the above example. This is the full Eleventy data cascade and may be more useful in other templating languages." The only reasonably-simple fix I can see is a first-class division between assets, templates, and data. Data has already been seperated with addDataExtension. An addAssetExtension could do the same for assets. In the case of 'templates', we are looking at something that has both 'layout' and 'data'. In the case of 'data', we have only data and no output file. But with assets, we will need to have an output file, and possibly data, but no layout. Ideally Eleventy would allow us to simply define based on configuration which of the the following three functions it should perform on which extensions/files/globs:
Of course, I'm guessing to do this in a more clear and reusable way would break the API and also creep into something too general-purpose (which is already how the problem began). So addAssetExtension is probably a good enough solution :). In the short term, there are several user-level hacks when a directory-wide (or root directory) layout default is good for content creators:
|
These are great points, I’m going to milestone this for 3.0 |
Related #2854 |
I think the most straightforward path here is to add a https://www.11ty.dev/docs/languages/custom/ Built-in template syntax will have this enabled and custom engines will have this enabled by default for the 3.0 release. Whether or not the Setting I also filed an additional enhancement issue to opt-out entirely from the Data Cascade for a custom template engine too, if you’d like to subscribe to track future progress: #3336
|
useLayouts
option for Custom template syntax allows opt-out of Eleventy Layouts for a template type
Operating system
Debian Testing
Eleventy
2.0.0
Describe the bug
Per instructions on the website and in various github issues, default layouts can be provided at the directory level (including the root via various methods). Unfortunately, these layouts are not specified to relevant file types and will wrap ALL 'templates' with the layout template, including assets that intend to generate css or javascript (or other new applications, like processing images).
Reproduction steps
Expected behavior
Expect that SCSS files will not be treated as an object with a 'layout'.
Reproduction URL
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered: